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];
 
   77        $query = 
'SELECT COUNT(*) num FROM ldap_role_assignments ' .
 
   78            'WHERE add_on_update = 1 ' .
 
   79            'OR remove_on_update = 1 ';
 
   94                include_once 
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
 
  101                if (!isset($a_user_data[$attn])) {
 
  105                if (!is_array($a_user_data[$attn])) {
 
  106                    $attribute_val = array(0 => $a_user_data[$attn]);
 
  108                    $attribute_val = $a_user_data[$attn];
 
  111                foreach ($attribute_val as $value) {
 
  127        $pattern = str_replace(
'*', 
'.*?', $a_str1);
 
  128        $this->logger->debug(
': Replace pattern:' . $pattern . 
' => ' . $a_str2);
 
  129        return (
bool) preg_match(
'/^' . $pattern . 
'$/i', $a_str2);
 
  145            if (
$server->enabledEscapeDN()) {
 
  146                $user_cmp = ldap_escape($a_user_data[
'dn'], 
"", LDAP_ESCAPE_FILTER);
 
  148                $user_cmp = $a_user_data[
'dn'];
 
  151            $user_cmp = $a_user_data[
'ilExternalAccount'];
 
  167            return $res->numRows() ? 
true : 
false;
 
  169            $this->logger->warning(
': Caught Exception: ' . 
$e->getMessage());
 
  186        $query = 
"SELECT rule_id FROM ldap_role_assignments " .
 
  187                "WHERE server_id = " . 
$ilDB->quote($a_server_id, 
'integer');
 
  192        return $rules ? $rules : array();
 
  204        $this->role_id = $a_role_id;
 
  215        return $this->role_id;
 
  226        return $this->rule_id;
 
  238        $this->server_id = $a_id;
 
  261        $this->type = $a_type;
 
  308        $this->member_attribute = $a_attribute;
 
  319        return $this->member_attribute;
 
  331        $this->member_is_dn = $a_status;
 
  342        return (
bool) $this->member_is_dn;
 
  354        $this->attribute_name = $a_name;
 
  365        return $this->attribute_name;
 
  377        $this->attribute_value = $a_value;
 
  388        return $this->attribute_value;
 
  393        $this->add_on_update = $a_status;
 
  403        $this->remove_on_update = $a_status;
 
  413        $this->plugin_id = $a_id;
 
  442                $dn_arr = explode(
',', $this->
getDN());
 
  462        $next_id = 
$ilDB->nextId(
'ldap_role_assignments');
 
  464        $query = 
"INSERT INTO ldap_role_assignments (server_id,rule_id,type,dn,attribute,isdn,att_name,att_value,role_id, " .
 
  465            "add_on_update, remove_on_update, plugin_id ) " .
 
  467            $this->db->quote($this->
getServerId(), 
'integer') . 
", " .
 
  468            $this->db->quote($next_id, 
'integer') . 
", " .
 
  469            $this->db->quote($this->
getType(), 
'integer') . 
", " .
 
  470            $this->db->quote($this->
getDN(), 
'text') . 
", " .
 
  475            $this->db->quote($this->
getRoleId(), 
'integer') . 
", " .
 
  478            $this->db->quote($this->
getPluginId(), 
'integer') . 
' ' .
 
  481        $this->rule_id = $next_id;
 
  496        $query = 
"UPDATE ldap_role_assignments " .
 
  497            "SET server_id = " . $this->db->quote($this->
getServerId(), 
'integer') . 
", " .
 
  498            "type = " . $this->db->quote($this->
getType(), 
'integer') . 
", " .
 
  499            "dn = " . $this->db->quote($this->
getDN(), 
'text') . 
", " .
 
  502            "att_name = " . $this->db->quote($this->
getAttributeName(), 
'text') . 
", " .
 
  504            "role_id = " . $this->db->quote($this->
getRoleId(), 
'integer') . 
", " .
 
  507            'plugin_id = ' . $this->db->quote($this->
getPluginId(), 
'integer') . 
' ' .
 
  508            "WHERE rule_id = " . $this->db->quote($this->
getRuleId(), 
'integer') . 
" ";
 
  528            $ilErr->setMessage(
'fill_out_all_required_fields');
 
  534                    $ilErr->setMessage(
'fill_out_all_required_fields');
 
  540                    $ilErr->setMessage(
'fill_out_all_required_fields');
 
  547                    $ilErr->setMessage(
'ldap_err_missing_plugin_id');
 
  553                $ilErr->setMessage(
'ldap_no_type_given');
 
  565    public function delete()
 
  569        $query = 
"DELETE FROM ldap_role_assignments " .
 
  570            "WHERE rule_id = " . $this->db->quote($this->
getRuleId(), 
'integer') . 
" ";
 
  584        $query = 
"SELECT * FROM ldap_role_assignments " .
 
  585            "WHERE rule_id = " . $this->db->quote($this->
getRuleId(), 
'integer') . 
" ";
 
  591            $this->
setDN($row->dn);
 
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
An exception for terminatinating execution or to throw for unit testing.
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.
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
foreach($_POST as $key=> $value) $res