57        $this->server_id = $a_server_id;
 
   70        if (array_key_exists($a_server_id, self::$instances) and is_object(self::$instances[$a_server_id])) {
 
   71            return self::$instances[$a_server_id];
 
   82        $query = 
"DELETE FROM ldap_rg_mapping " .
 
   83            "WHERE role = " . 
$ilDB->quote($a_role_id, 
'integer');
 
   95        $query = 
"DELETE FROM ldap_rg_mapping " .
 
   96            "WHERE server_id = " . 
$ilDB->quote($a_server_id, 
'integer');
 
  107        $rbacreview = 
$DIC[
'rbacreview'];
 
  109        $query = 
"SELECT rgm.* FROM ldap_rg_mapping rgm JOIN ldap_server_settings lss " .
 
  110            "ON rgm.server_id = lss.server_id " .
 
  111            "WHERE lss.active = 1 " .
 
  112            "AND lss.role_sync_active = 1 ";
 
  114        while ($row = 
$ilDB->fetchObject(
$res)) {
 
  115            $data[
'server_id'] = $row->server_id;
 
  116            $data[
'url'] = $row->url;
 
  117            $data[
'mapping_id'] = $row->mapping_id;
 
  118            $data[
'dn'] = $row->dn;
 
  119            $data[
'member'] = $row->member_attribute;
 
  120            $data[
'isdn'] = $row->member_isdn;
 
  121            $data[
'info'] = $row->mapping_info;
 
  122            $data[
'info_type'] = $row->mapping_info_type;
 
  124            $data[
'object_id'] = $rbacreview->getObjectOfRole($row->role);
 
  127            $active[$row->role][] = 
$data;
 
  129        return $active ? $active : array();
 
  145        return $this->mappings ? $this->mappings : array();
 
  152        $rbacreview = 
$DIC[
'rbacreview'];
 
  158        $this->mappings = array();
 
  159        foreach ($a_mappings as $mapping_id => 
$data) {
 
  160            if ($mapping_id == 0) {
 
  187        $rbacreview = 
$DIC[
'rbacreview'];
 
  190        $found_missing = 
false;
 
  191        foreach ($this->mappings as $mapping_id => 
$data) {
 
  193            if (!strlen(
$data[
'dn']) || !strlen(
$data[
'member_attribute']) || !strlen(
$data[
'role_name'])) {
 
  194                if (!$found_missing) {
 
  195                    $found_missing = 
true;
 
  196                    $ilErr->appendMessage($this->lng->txt(
'fill_out_all_required_fields'));
 
  200            if (strlen(
$data[
'role_name']) and !$rbacreview->roleExists(
$data[
'role_name'])) {
 
  201                $ilErr->appendMessage($this->lng->txt(
'ldap_role_not_exists') . 
' ' . 
$data[
'role_name']);
 
  204        return strlen(
$ilErr->getMessage()) ? false : 
true;
 
  220        foreach ($this->mappings as $mapping_id => 
$data) {
 
  222                $next_id = 
$ilDB->nextId(
'ldap_rg_mapping');
 
  223                $query = 
"INSERT INTO ldap_rg_mapping (mapping_id,server_id,url,dn,member_attribute,member_isdn,role,mapping_info,mapping_info_type) " .
 
  225                    $ilDB->quote($next_id, 
'integer') . 
", " .
 
  226                    $this->db->quote($this->
getServerId(), 
'integer') . 
", " .
 
  227                    $this->db->quote(
$data[
'url'], 
'text') . 
", " .
 
  228                    $this->db->quote(
$data[
'dn'], 
'text') . 
", " .
 
  229                    $this->db->quote(
$data[
'member_attribute'], 
'text') . 
", " .
 
  230                    $this->db->quote(
$data[
'member_isdn'], 
'integer') . 
", " .
 
  231                    $this->db->quote(
$data[
'role'], 
'integer') . 
", " .
 
  232                    $this->db->quote(
$data[
'info'], 
'text') . 
", " .
 
  233                    $this->db->quote(
$data[
'info_type'], 
'integer') .
 
  237                $query = 
"UPDATE ldap_rg_mapping " .
 
  238                    "SET server_id = " . $this->db->quote($this->
getServerId(), 
'integer') . 
", " .
 
  239                    "url = " . $this->db->quote(
$data[
'url'], 
'text') . 
", " .
 
  240                    "dn =" . $this->db->quote(
$data[
'dn'], 
'text') . 
", " .
 
  241                    "member_attribute = " . $this->db->quote(
$data[
'member_attribute'], 
'text') . 
", " .
 
  242                    "member_isdn = " . $this->db->quote(
$data[
'member_isdn'], 
'integer') . 
", " .
 
  243                    "role = " . $this->db->quote(
$data[
'role'], 
'integer') . 
", " .
 
  244                    "mapping_info = " . $this->db->quote(
$data[
'info'], 
'text') . 
", " .
 
  245                    "mapping_info_type = " . $this->db->quote(
$data[
'info_type'], 
'integer') . 
" " .
 
  246                    "WHERE mapping_id = " . $this->db->quote($mapping_id, 
'integer');
 
  261    public function delete($a_mapping_id)
 
  267        $query = 
"DELETE FROM ldap_rg_mapping " .
 
  268            "WHERE server_id = " . $this->db->quote($this->
getServerId(), 
'integer') . 
" " .
 
  269            "AND mapping_id = " . $this->db->quote($a_mapping_id, 
'integer');
 
  283        $role = $this->mappings[$a_mapping_id][
'role_name'];
 
  284        $dn_parts = explode(
',', $this->mappings[$a_mapping_id][
'dn']);
 
  286        return (array_key_exists(0, $dn_parts) ? $dn_parts[0] : 
"''");
 
  300        $ilObjDataCache = 
$DIC[
'ilObjDataCache'];
 
  301        $rbacreview = 
$DIC[
'rbacreview'];
 
  302        $tree = 
$DIC[
'tree'];
 
  304        $this->mappings = array();
 
  305        $query = 
"SELECT * FROM ldap_rg_mapping LEFT JOIN object_data " .
 
  306            "ON role = obj_id " .
 
  307            "WHERE server_id =" . $this->db->quote($this->
getServerId(), 
'integer') . 
' ' .
 
  312            $this->mappings[$row->mapping_id][
'mapping_id'] = $row->mapping_id;
 
  313            $this->mappings[$row->mapping_id][
'dn'] = $row->dn;
 
  314            $this->mappings[$row->mapping_id][
'url'] = $row->url;
 
  315            $this->mappings[$row->mapping_id][
'member_attribute'] = $row->member_attribute;
 
  316            $this->mappings[$row->mapping_id][
'member_isdn'] = $row->member_isdn;
 
  317            $this->mappings[$row->mapping_id][
'role'] = $row->role;
 
  318            $this->mappings[$row->mapping_id][
'info'] = $row->mapping_info;
 
  319            $this->mappings[$row->mapping_id][
'info_type'] = $row->mapping_info_type;
 
  320            if ($ilObjDataCache->lookupType($row->role) == 
'role') {
 
  321                $this->mappings[$row->mapping_id][
'role_name'] = $ilObjDataCache->lookupTitle($row->role);
 
  323                $this->mappings[$row->mapping_id][
'role_name'] = $row->role;
 
An exception for terminatinating execution or to throw for unit testing.
getMappingInfoString($a_mapping_id)
Create an info string for a role group mapping.
__construct($a_server_id)
Private constructor (Singleton for each server_id)
static _deleteByRole($a_role_id)
const MAPPING_INFO_INFO_ONLY
validate()
Validate mappings.
getMappings()
Get already configured mappings.
static _getInstanceByServerId($a_server_id)
Get instance of class.
static _getAllActiveMappings()
loadFromPost($a_mappings)
static _deleteByServerId($a_server_id)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
foreach($_POST as $key=> $value) $res