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 ';
 
  109                                include_once 
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
 
  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)
 
  155                $pattern = str_replace(
'*',
'.*?', $a_str1);
 
  156                $GLOBALS[
'ilLog']->write(__METHOD__.
': Replace pattern:'. $pattern.
' => '.$a_str2);
 
  157                return (
bool) preg_match(
'/^'.$pattern.
'$/i',$a_str2);
 
  175                        $user_cmp = $a_user_data[
'dn'];
 
  179                        $user_cmp = $a_user_data[
'ilExternalAccount'];
 
  182                include_once(
'Services/LDAP/classes/class.ilLDAPQuery.php');
 
  183                include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
 
  197                        return $res->numRows() ? true : 
false;
 
  201                        $ilLog->write(__METHOD__.
': Caught Exception: '.$e->getMessage());
 
  218                $query = 
"SELECT rule_id FROM ldap_role_assignments ".
 
  219                                "WHERE server_id = ".$ilDB->quote($a_server_id,
'integer');
 
  225                return $rules ? $rules : array();
 
  237                $this->role_id = $a_role_id;    
 
  248                return $this->role_id;
 
  259                return $this->rule_id;
 
  271                $this->server_id = $a_id;
 
  294                $this->type = $a_type;
 
  341                $this->member_attribute = $a_attribute;
 
  352                return $this->member_attribute;
 
  364                $this->member_is_dn = $a_status;
 
  375                return (
bool) $this->member_is_dn;
 
  387                $this->attribute_name = $a_name;
 
  398                return $this->attribute_name;
 
  410                $this->attribute_value = $a_value;
 
  421                return $this->attribute_value;
 
  426                $this->add_on_update = $a_status;
 
  436                $this->remove_on_update = $a_status;
 
  446                $this->plugin_id = $a_id;
 
  473                                return $lng->txt(
'ldap_plugin_id').
': '.$this->
getPluginId();
 
  476                                $dn_arr = explode(
',',$this->
getDN());
 
  497                $next_id = 
$ilDB->nextId(
'ldap_role_assignments');
 
  499                $query = 
"INSERT INTO ldap_role_assignments (server_id,rule_id,type,dn,attribute,isdn,att_name,att_value,role_id, ".
 
  500                        "add_on_update, remove_on_update, plugin_id ) ".
 
  502                        $this->db->quote($this->
getServerId(),
'integer').
", ".
 
  503                        $this->db->quote($next_id,
'integer').
", ".
 
  504                        $this->db->quote($this->
getType(),
'integer').
", ".
 
  505                        $this->db->quote($this->
getDN(),
'text').
", ".
 
  510                        $this->db->quote($this->
getRoleId(),
'integer').
", ".
 
  513                        $this->db->quote($this->
getPluginId(),
'integer').
' '.
 
  516                $this->rule_id = $next_id;
 
  531                $query = 
"UPDATE ldap_role_assignments ".
 
  532                        "SET server_id = ".$this->db->quote($this->
getServerId(),
'integer').
", ".
 
  533                        "type = ".$this->db->quote($this->
getType(),
'integer').
", ".
 
  534                        "dn = ".$this->db->quote($this->
getDN(),
'text').
", ".
 
  539                        "role_id = ".$this->db->quote($this->
getRoleId(),
'integer').
", ".
 
  542                        'plugin_id = '.$this->db->quote($this->
getPluginId(),
'integer').
' '.
 
  543                        "WHERE rule_id = ".$this->db->quote($this->
getRuleId(),
'integer').
" ";
 
  562                        $ilErr->setMessage(
'fill_out_all_required_fields');
 
  570                                        $ilErr->setMessage(
'fill_out_all_required_fields');
 
  577                                        $ilErr->setMessage(
'fill_out_all_required_fields');
 
  585                                        $ilErr->setMessage(
'ldap_err_missing_plugin_id');
 
  591                                $ilErr->setMessage(
'ldap_no_type_given');
 
  603        public function delete()
 
  607                $query = 
"DELETE FROM ldap_role_assignments ".
 
  608                        "WHERE rule_id = ".$this->db->quote($this->
getRuleId(),
'integer').
" ";
 
  623                $query = 
"SELECT * FROM ldap_role_assignments ".
 
  624                        "WHERE rule_id = ".$this->db->quote($this->
getRuleId(),
'integer').
" ";
 
const DB_FETCHMODE_OBJECT
isGroupMember($a_user_data)
Check if user is member of specific group.
getServerId()
get server id
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
_getRules($a_server_id)
Get all rules.
__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 _getFirstActiveServer()
Get first active server.
static _lookupTitle($a_id)
lookup object title
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.