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])) {
 
   62            return self::$instances[$a_rule_id];
 
   75        $query = 
'SELECT COUNT(*) num FROM ldap_role_assignments ' .
 
   76            'WHERE add_on_update = 1 ' .
 
   77            'OR remove_on_update = 1 ';
 
   92                include_once 
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
 
   99                if (!isset($a_user_data[$attn])) {
 
  103                if (!is_array($a_user_data[$attn])) {
 
  104                    $attribute_val = array(0 => $a_user_data[$attn]);
 
  106                    $attribute_val = $a_user_data[$attn];
 
  109                foreach ($attribute_val as $value) {
 
  125        $pattern = str_replace(
'*', 
'.*?', $a_str1);
 
  126        $this->logger->debug(
': Replace pattern:' . $pattern . 
' => ' . $a_str2);
 
  127        return (
bool) preg_match(
'/^' . $pattern . 
'$/i', $a_str2);
 
  141            $user_cmp = $a_user_data[
'dn'];
 
  143            $user_cmp = $a_user_data[
'ilExternalAccount'];
 
  146        include_once(
'Services/LDAP/classes/class.ilLDAPQuery.php');
 
  147        include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
 
  164            return $res->numRows() ? true : 
false;
 
  166            $this->logger->warning(
': Caught Exception: ' . $e->getMessage());
 
  183        $query = 
"SELECT rule_id FROM ldap_role_assignments " .
 
  184                "WHERE server_id = " . 
$ilDB->quote($a_server_id, 
'integer');
 
  189        return $rules ? $rules : array();
 
  201        $this->role_id = $a_role_id;
 
  212        return $this->role_id;
 
  223        return $this->rule_id;
 
  235        $this->server_id = $a_id;
 
  305        $this->member_attribute = $a_attribute;
 
  316        return $this->member_attribute;
 
  328        $this->member_is_dn = $a_status;
 
  339        return (
bool) $this->member_is_dn;
 
  351        $this->attribute_name = $a_name;
 
  362        return $this->attribute_name;
 
  374        $this->attribute_value = $a_value;
 
  385        return $this->attribute_value;
 
  390        $this->add_on_update = $a_status;
 
  400        $this->remove_on_update = $a_status;
 
  410        $this->plugin_id = $a_id;
 
  439                $dn_arr = explode(
',', $this->
getDN());
 
  459        $next_id = 
$ilDB->nextId(
'ldap_role_assignments');
 
  461        $query = 
"INSERT INTO ldap_role_assignments (server_id,rule_id,type,dn,attribute,isdn,att_name,att_value,role_id, " .
 
  462            "add_on_update, remove_on_update, plugin_id ) " .
 
  464            $this->db->quote($this->
getServerId(), 
'integer') . 
", " .
 
  465            $this->db->quote($next_id, 
'integer') . 
", " .
 
  466            $this->db->quote($this->
getType(), 
'integer') . 
", " .
 
  467            $this->db->quote($this->
getDN(), 
'text') . 
", " .
 
  472            $this->db->quote($this->
getRoleId(), 
'integer') . 
", " .
 
  475            $this->db->quote($this->
getPluginId(), 
'integer') . 
' ' .
 
  478        $this->rule_id = $next_id;
 
  493        $query = 
"UPDATE ldap_role_assignments " .
 
  494            "SET server_id = " . $this->db->quote($this->
getServerId(), 
'integer') . 
", " .
 
  495            "type = " . $this->db->quote($this->
getType(), 
'integer') . 
", " .
 
  496            "dn = " . $this->db->quote($this->
getDN(), 
'text') . 
", " .
 
  499            "att_name = " . $this->db->quote($this->
getAttributeName(), 
'text') . 
", " .
 
  501            "role_id = " . $this->db->quote($this->
getRoleId(), 
'integer') . 
", " .
 
  504            'plugin_id = ' . $this->db->quote($this->
getPluginId(), 
'integer') . 
' ' .
 
  505            "WHERE rule_id = " . $this->db->quote($this->
getRuleId(), 
'integer') . 
" ";
 
  523            $ilErr->setMessage(
'fill_out_all_required_fields');
 
  529                    $ilErr->setMessage(
'fill_out_all_required_fields');
 
  535                    $ilErr->setMessage(
'fill_out_all_required_fields');
 
  542                    $ilErr->setMessage(
'ldap_err_missing_plugin_id');
 
  548                $ilErr->setMessage(
'ldap_no_type_given');
 
  560    public function delete()
 
  564        $query = 
"DELETE FROM ldap_role_assignments " .
 
  565            "WHERE rule_id = " . $this->db->quote($this->
getRuleId(), 
'integer') . 
" ";
 
  579        $query = 
"SELECT * FROM ldap_role_assignments " .
 
  580            "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.
foreach($_POST as $key=> $value) $res