44                $this->db = 
$GLOBALS[
'DIC']->database();
 
   45                $this->logger = 
$GLOBALS[
'DIC']->logger()->auth();
 
   47                $this->rule_id = $a_id;
 
   61                if(isset(self::$instances[$a_rule_id]))
 
   63                        return self::$instances[$a_rule_id];
 
   76                $query = 
'SELECT COUNT(*) num FROM ldap_role_assignments '.
 
   77                        'WHERE add_on_update = 1 '.
 
   78                        'OR remove_on_update = 1 ';
 
   94                                include_once 
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
 
  101                                if(!isset($a_user_data[$attn]))
 
  106                                if(!is_array($a_user_data[$attn]))
 
  108                                        $attribute_val = array(0 => $a_user_data[$attn]);
 
  112                                        $attribute_val = $a_user_data[$attn];
 
  115                                foreach($attribute_val as $value)
 
  133                $pattern = str_replace(
'*',
'.*?', $a_str1);
 
  134                $this->logger->debug(
': Replace pattern:'. $pattern.
' => '.$a_str2);
 
  135                return (
bool) preg_match(
'/^'.$pattern.
'$/i',$a_str2);
 
  150                        $user_cmp = $a_user_data[
'dn'];
 
  154                        $user_cmp = $a_user_data[
'ilExternalAccount'];
 
  157                include_once(
'Services/LDAP/classes/class.ilLDAPQuery.php');
 
  158                include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
 
  172                        return $res->numRows() ? true : 
false;
 
  176                        $this->logger->warning(
': Caught Exception: '.$e->getMessage());
 
  193                $query = 
"SELECT rule_id FROM ldap_role_assignments ".
 
  194                                "WHERE server_id = ".$ilDB->quote($a_server_id,
'integer');
 
  200                return $rules ? $rules : array();
 
  212                $this->role_id = $a_role_id;    
 
  223                return $this->role_id;
 
  234                return $this->rule_id;
 
  246                $this->server_id = $a_id;
 
  316                $this->member_attribute = $a_attribute;
 
  327                return $this->member_attribute;
 
  339                $this->member_is_dn = $a_status;
 
  350                return (
bool) $this->member_is_dn;
 
  362                $this->attribute_name = $a_name;
 
  373                return $this->attribute_name;
 
  385                $this->attribute_value = $a_value;
 
  396                return $this->attribute_value;
 
  401                $this->add_on_update = $a_status;
 
  411                $this->remove_on_update = $a_status;
 
  421                $this->plugin_id = $a_id;
 
  451                                $dn_arr = explode(
',',$this->
getDN());
 
  471                $next_id = 
$ilDB->nextId(
'ldap_role_assignments');
 
  473                $query = 
"INSERT INTO ldap_role_assignments (server_id,rule_id,type,dn,attribute,isdn,att_name,att_value,role_id, ".
 
  474                        "add_on_update, remove_on_update, plugin_id ) ".
 
  476                        $this->db->quote($this->
getServerId(),
'integer').
", ".
 
  477                        $this->db->quote($next_id,
'integer').
", ".
 
  478                        $this->db->quote($this->
getType(),
'integer').
", ".
 
  479                        $this->db->quote($this->
getDN(),
'text').
", ".
 
  484                        $this->db->quote($this->
getRoleId(),
'integer').
", ".
 
  487                        $this->db->quote($this->
getPluginId(),
'integer').
' '.
 
  490                $this->rule_id = $next_id;
 
  505                $query = 
"UPDATE ldap_role_assignments ".
 
  506                        "SET server_id = ".$this->db->quote($this->
getServerId(),
'integer').
", ".
 
  507                        "type = ".$this->db->quote($this->
getType(),
'integer').
", ".
 
  508                        "dn = ".$this->db->quote($this->
getDN(),
'text').
", ".
 
  513                        "role_id = ".$this->db->quote($this->
getRoleId(),
'integer').
", ".
 
  516                        'plugin_id = '.$this->db->quote($this->
getPluginId(),
'integer').
' '.
 
  517                        "WHERE rule_id = ".$this->db->quote($this->
getRuleId(),
'integer').
" ";
 
  536                        $ilErr->setMessage(
'fill_out_all_required_fields');
 
  544                                        $ilErr->setMessage(
'fill_out_all_required_fields');
 
  551                                        $ilErr->setMessage(
'fill_out_all_required_fields');
 
  559                                        $ilErr->setMessage(
'ldap_err_missing_plugin_id');
 
  565                                $ilErr->setMessage(
'ldap_no_type_given');
 
  577        public function delete()
 
  581                $query = 
"DELETE FROM ldap_role_assignments ".
 
  582                        "WHERE rule_id = ".$this->db->quote($this->
getRuleId(),
'integer').
" ";
 
  597                $query = 
"SELECT * FROM ldap_role_assignments ".
 
  598                        "WHERE rule_id = ".$this->db->quote($this->
getRuleId(),
'integer').
" ";
 
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
isGroupMember($a_user_data)
Check if user is member of specific group.
getServerId()
get server id
static _getRules($a_server_id)
Get all rules.
setServerId($a_id)
set server id
wildcardCompare($a_str1, $a_str2)
setMemberAttribute($a_attribute)
@access public
getAttributeValue()
get atrtibute value
matches($a_user_data)
Check if a rule matches.
setAttributeName($a_name)
set attribute name
getAttributeName()
get attribute name
conditionToString()
condition to string
isMemberAttributeDN()
is member attribute dn
isRemoveOnUpdateEnabled()
static hasRulesForUpdate()
Check if there any rule for updates.
setRoleId($a_role_id)
set role id
static _getInstanceByRuleId($a_rule_id)
get instance by rule id
__construct($a_id=0)
Constructor.
setAttributeValue($a_value)
set attribute value
getMemberAttribute()
get attribute
setMemberIsDN($a_status)
set member attribute is dn
enableRemoveOnUpdate($a_status)
enableAddOnUpdate($a_status)
static callPlugin($a_plugin_id, $a_user_data)
Call plugin check if the condition matches.
static getInstanceByServerId($a_server_id)
Get instance by server id.
static _lookupTitle($a_id)
lookup object title
$GLOBALS['loaded']
Global hash that tracks already loaded includes.