60 $this->rule_id = $a_id;
74 if(isset(self::$instances[$a_rule_id]))
76 return self::$instances[$a_rule_id];
89 $query =
'SELECT COUNT(*) num FROM ldap_role_assignments '.
90 'WHERE add_on_update = 1 '.
91 'OR remove_on_update = 1 ';
108 case self::TYPE_PLUGIN:
109 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
112 case self::TYPE_ATTRIBUTE:
116 if(!isset($a_user_data[$attn]))
121 if(!is_array($a_user_data[$attn]))
123 $attribute_val = array(0 => $a_user_data[$attn]);
127 $attribute_val = $a_user_data[$attn];
130 foreach($attribute_val as $value)
140 case self::TYPE_GROUP:
161 $user_cmp = $a_user_data[
'dn'];
165 $user_cmp = $a_user_data[
'ilExternalAccount'];
168 include_once(
'Services/LDAP/classes/class.ilLDAPQuery.php');
169 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
183 return $res->numRows() ?
true :
false;
187 $ilLog->write(__METHOD__.
': Caught Exception: '.$e->getMessage());
204 $query =
"SELECT rule_id FROM ldap_role_assignments ";
210 return $rules ? $rules : array();
222 $this->role_id = $a_role_id;
233 return $this->role_id;
244 return $this->rule_id;
256 $this->server_id = $a_id;
279 $this->type = $a_type;
326 $this->member_attribute = $a_attribute;
337 return $this->member_attribute;
349 $this->member_is_dn = $a_status;
360 return (
bool) $this->member_is_dn;
372 $this->attribute_name = $a_name;
383 return $this->attribute_name;
395 $this->attribute_value = $a_value;
406 return $this->attribute_value;
411 $this->add_on_update = $a_status;
421 $this->remove_on_update = $a_status;
431 $this->plugin_id = $a_id;
457 case self::TYPE_PLUGIN:
458 return $lng->txt(
'ldap_plugin_id').
': '.$this->
getPluginId();
460 case self::TYPE_GROUP:
461 $dn_arr = explode(
',',$this->
getDN());
465 case self::TYPE_ATTRIBUTE:
482 $next_id = $ilDB->nextId(
'ldap_role_assignments');
484 $query =
"INSERT INTO ldap_role_assignments (server_id,rule_id,type,dn,attribute,isdn,att_name,att_value,role_id, ".
485 "add_on_update, remove_on_update, plugin_id ) ".
487 $this->db->quote($this->
getServerId(),
'integer').
", ".
488 $this->db->quote($next_id,
'integer').
", ".
489 $this->db->quote($this->
getType(),
'integer').
", ".
490 $this->db->quote($this->
getDN(),
'text').
", ".
495 $this->db->quote($this->
getRoleId(),
'integer').
", ".
498 $this->db->quote($this->
getPluginId(),
'integer').
' '.
501 $this->rule_id = $next_id;
516 $query =
"UPDATE ldap_role_assignments ".
517 "SET server_id = ".$this->db->quote($this->
getServerId(),
'integer').
", ".
518 "type = ".$this->db->quote($this->
getType(),
'integer').
", ".
519 "dn = ".$this->db->quote($this->
getDN(),
'text').
", ".
524 "role_id = ".$this->db->quote($this->
getRoleId(),
'integer').
", ".
527 'plugin_id = '.$this->db->quote($this->
getPluginId(),
'integer').
' '.
528 "WHERE rule_id = ".$this->db->quote($this->
getRuleId(),
'integer').
" ";
543 $ilErr->setMessage(
'');
547 $ilErr->setMessage(
'fill_out_all_required_fields');
552 case self::TYPE_GROUP:
555 $ilErr->setMessage(
'fill_out_all_required_fields');
559 case self::TYPE_ATTRIBUTE:
562 $ilErr->setMessage(
'fill_out_all_required_fields');
567 case self::TYPE_PLUGIN:
570 $ilErr->setMessage(
'ldap_err_missing_plugin_id');
576 $ilErr->setMessage(
'ldap_no_type_given');
588 public function delete()
592 $query =
"DELETE FROM ldap_role_assignments ".
593 "WHERE rule_id = ".$this->db->quote($this->
getRuleId(),
'integer').
" ";
608 $query =
"SELECT * FROM ldap_role_assignments ".
609 "WHERE rule_id = ".$this->db->quote($this->
getRuleId(),
'integer').
" ";