ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilLDAPRoleAssignmentRule Class Reference
+ Collaboration diagram for ilLDAPRoleAssignmentRule:

Public Member Functions

 matches ($a_user_data)
 Check if a rule matches. More...
 
 setRoleId ($a_role_id)
 set role id More...
 
 getRoleId ()
 get role id More...
 
 getRuleId ()
 get id More...
 
 setServerId ($a_id)
 set server id More...
 
 getServerId ()
 get server id More...
 
 setType ($a_type)
 set type More...
 
 getType ()
 getType More...
 
 setDN ($a_dn)
 set dn More...
 
 getDN ()
 get dn More...
 
 setMemberAttribute ($a_attribute)
 public More...
 
 getMemberAttribute ()
 get attribute More...
 
 setMemberIsDN ($a_status)
 set member attribute is dn More...
 
 isMemberAttributeDN ()
 is member attribute dn More...
 
 setAttributeName ($a_name)
 set attribute name More...
 
 getAttributeName ()
 get attribute name More...
 
 setAttributeValue ($a_value)
 set attribute value More...
 
 getAttributeValue ()
 get atrtibute value More...
 
 enableAddOnUpdate ($a_status)
 
 isAddOnUpdateEnabled ()
 
 enableRemoveOnUpdate ($a_status)
 
 isRemoveOnUpdateEnabled ()
 
 setPluginId ($a_id)
 
 getPluginId ()
 
 isPluginActive ()
 
 conditionToString ()
 condition to string More...
 
 create ()
 create More...
 
 update ()
 update More...
 
 validate ()
 validate More...
 
 delete ()
 delete rule More...
 

Static Public Member Functions

static _getInstanceByRuleId ($a_rule_id)
 get instance by rule id More...
 
static hasRulesForUpdate ()
 Check if there any rule for updates. More...
 
static _getRules ($a_server_id)
 Get all rules. More...
 

Data Fields

const TYPE_GROUP = 1
 
const TYPE_ATTRIBUTE = 2
 
const TYPE_PLUGIN = 3
 

Protected Member Functions

 wildcardCompare ($a_str1, $a_str2)
 

Private Member Functions

 __construct ($a_id=0)
 Constructor. More...
 
 isGroupMember ($a_user_data)
 Check if user is member of specific group. More...
 
 read ()
 load from db More...
 

Private Attributes

 $logger = null
 
 $db = null
 
 $server_id = 0
 
 $plugin_active = false
 
 $add_on_update = false
 
 $remove_on_update = false
 
 $plugin_id = 0
 

Static Private Attributes

static $instances = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLDAPRoleAssignmentRule::__construct (   $a_id = 0)
private

Constructor.

private

Parameters
intrule id

Definition at line 42 of file class.ilLDAPRoleAssignmentRule.php.

References $GLOBALS, and read().

43  {
44  $this->db = $GLOBALS['DIC']->database();
45  $this->logger = $GLOBALS['DIC']->logger()->auth();
46 
47  $this->rule_id = $a_id;
48  $this->read();
49  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
+ Here is the call graph for this function:

Member Function Documentation

◆ _getInstanceByRuleId()

static ilLDAPRoleAssignmentRule::_getInstanceByRuleId (   $a_rule_id)
static

get instance by rule id

public

Parameters
intrule id

Definition at line 59 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by ilLDAPSettingsGUI\confirmDeleteRules(), ilLDAPSettingsGUI\deleteRules(), ilLDAPSettingsGUI\editRoleAssignment(), ilLDAPRoleAssignmentRules\getAssignmentsForCreation(), ilLDAPRoleAssignmentRules\getAssignmentsForUpdate(), ilLDAPSettingsGUI\loadRoleAssignmentRule(), and ilLDAPSettingsGUI\roleAssignments().

60  {
61  if (isset(self::$instances[$a_rule_id])) {
62  return self::$instances[$a_rule_id];
63  }
64  return self::$instances[$a_rule_id] = new ilLDAPRoleAssignmentRule($a_rule_id);
65  }
+ Here is the caller graph for this function:

◆ _getRules()

static ilLDAPRoleAssignmentRule::_getRules (   $a_server_id)
static

Get all rules.

public

Returns
ilLDAPRoleAssignmentRule

Definition at line 179 of file class.ilLDAPRoleAssignmentRule.php.

References $GLOBALS, $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilLDAPServer\delete(), ilLDAPSettingsGUI\getRoleAssignmentTable(), and ilLDAPSettingsGUI\roleAssignments().

180  {
181  $ilDB = $GLOBALS['DIC']->database();
182 
183  $query = "SELECT rule_id FROM ldap_role_assignments " .
184  "WHERE server_id = " . $ilDB->quote($a_server_id, 'integer');
185  $res = $ilDB->query($query);
186  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
187  $rules[] = self::_getInstanceByRuleId($row->rule_id);
188  }
189  return $rules ? $rules : array();
190  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ conditionToString()

ilLDAPRoleAssignmentRule::conditionToString ( )

condition to string

public

Definition at line 430 of file class.ilLDAPRoleAssignmentRule.php.

References $GLOBALS, $lng, getAttributeName(), getAttributeValue(), getDN(), getPluginId(), and getType().

431  {
432  $lng = $GLOBALS['DIC']->language();
433 
434  switch ($this->getType()) {
435  case self::TYPE_PLUGIN:
436  return $lng->txt('ldap_plugin_id') . ': ' . $this->getPluginId();
437 
438  case self::TYPE_GROUP:
439  $dn_arr = explode(',', $this->getDN());
440  return $dn_arr[0];
441 
442 
443  case self::TYPE_ATTRIBUTE:
444  return $this->getAttributeName() . '=' . $this->getAttributeValue();
445  }
446  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ create()

ilLDAPRoleAssignmentRule::create ( )

create

public

Parameters

Definition at line 456 of file class.ilLDAPRoleAssignmentRule.php.

References $db, $ilDB, $query, $res, getAttributeName(), getAttributeValue(), getDN(), getMemberAttribute(), getPluginId(), getRoleId(), getServerId(), getType(), isAddOnUpdateEnabled(), isMemberAttributeDN(), and isRemoveOnUpdateEnabled().

457  {
458  $ilDB = $this->db;
459  $next_id = $ilDB->nextId('ldap_role_assignments');
460 
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 ) " .
463  "VALUES( " .
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') . ", " .
468  $this->db->quote($this->getMemberAttribute(), 'text') . ", " .
469  $this->db->quote($this->isMemberAttributeDN(), 'integer') . ", " .
470  $this->db->quote($this->getAttributeName(), 'text') . ", " .
471  $this->db->quote($this->getAttributeValue(), 'text') . ", " .
472  $this->db->quote($this->getRoleId(), 'integer') . ", " .
473  $this->db->quote($this->isAddOnUpdateEnabled(), 'integer') . ', ' .
474  $this->db->quote($this->isRemoveOnUpdateEnabled(), 'integer') . ', ' .
475  $this->db->quote($this->getPluginId(), 'integer') . ' ' .
476  ")";
477  $res = $ilDB->manipulate($query);
478  $this->rule_id = $next_id;
479 
480  return true;
481  }
isMemberAttributeDN()
is member attribute dn
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ delete()

ilLDAPRoleAssignmentRule::delete ( )

delete rule

public

Definition at line 560 of file class.ilLDAPRoleAssignmentRule.php.

References $db, $ilDB, $query, $res, and getRuleId().

561  {
562  $ilDB = $this->db;
563 
564  $query = "DELETE FROM ldap_role_assignments " .
565  "WHERE rule_id = " . $this->db->quote($this->getRuleId(), 'integer') . " ";
566  $res = $ilDB->manipulate($query);
567  return true;
568  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ enableAddOnUpdate()

ilLDAPRoleAssignmentRule::enableAddOnUpdate (   $a_status)

Definition at line 388 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by read().

389  {
390  $this->add_on_update = $a_status;
391  }
+ Here is the caller graph for this function:

◆ enableRemoveOnUpdate()

ilLDAPRoleAssignmentRule::enableRemoveOnUpdate (   $a_status)

Definition at line 398 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by read().

399  {
400  $this->remove_on_update = $a_status;
401  }
+ Here is the caller graph for this function:

◆ getAttributeName()

ilLDAPRoleAssignmentRule::getAttributeName ( )

get attribute name

public

Definition at line 360 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by conditionToString(), create(), matches(), update(), and validate().

361  {
362  return $this->attribute_name;
363  }
+ Here is the caller graph for this function:

◆ getAttributeValue()

ilLDAPRoleAssignmentRule::getAttributeValue ( )

get atrtibute value

public

Definition at line 383 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by conditionToString(), create(), matches(), update(), and validate().

384  {
385  return $this->attribute_value;
386  }
+ Here is the caller graph for this function:

◆ getDN()

ilLDAPRoleAssignmentRule::getDN ( )

get dn

public

Definition at line 291 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by conditionToString(), create(), isGroupMember(), update(), and validate().

292  {
293  return $this->dn;
294  }
+ Here is the caller graph for this function:

◆ getMemberAttribute()

ilLDAPRoleAssignmentRule::getMemberAttribute ( )

get attribute

public

Definition at line 314 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by create(), isGroupMember(), update(), and validate().

315  {
316  return $this->member_attribute;
317  }
+ Here is the caller graph for this function:

◆ getPluginId()

ilLDAPRoleAssignmentRule::getPluginId ( )

Definition at line 413 of file class.ilLDAPRoleAssignmentRule.php.

References $plugin_id.

Referenced by conditionToString(), create(), matches(), update(), and validate().

+ Here is the caller graph for this function:

◆ getRoleId()

ilLDAPRoleAssignmentRule::getRoleId ( )

get role id

public

Definition at line 210 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by create(), matches(), update(), and validate().

211  {
212  return $this->role_id;
213  }
+ Here is the caller graph for this function:

◆ getRuleId()

ilLDAPRoleAssignmentRule::getRuleId ( )

get id

public

Definition at line 221 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by delete(), read(), and update().

222  {
223  return $this->rule_id;
224  }
+ Here is the caller graph for this function:

◆ getServerId()

ilLDAPRoleAssignmentRule::getServerId ( )

get server id

public

Definition at line 244 of file class.ilLDAPRoleAssignmentRule.php.

References $server_id.

Referenced by create(), isGroupMember(), and update().

+ Here is the caller graph for this function:

◆ getType()

ilLDAPRoleAssignmentRule::getType ( )

getType

public

Parameters

Definition at line 268 of file class.ilLDAPRoleAssignmentRule.php.

References $type.

Referenced by conditionToString(), create(), isPluginActive(), matches(), update(), and validate().

269  {
270  return $this->type;
271  }
$type
+ Here is the caller graph for this function:

◆ hasRulesForUpdate()

static ilLDAPRoleAssignmentRule::hasRulesForUpdate ( )
static

Check if there any rule for updates.

Returns

Definition at line 71 of file class.ilLDAPRoleAssignmentRule.php.

References $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilLDAPUserSynchronisation\isUpdateRequired(), and ilAuthContainerApache\updateRequired().

72  {
73  global $ilDB;
74 
75  $query = 'SELECT COUNT(*) num FROM ldap_role_assignments ' .
76  'WHERE add_on_update = 1 ' .
77  'OR remove_on_update = 1 ';
78  $res = $ilDB->query($query);
80  return $row->num > 0;
81  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ isAddOnUpdateEnabled()

ilLDAPRoleAssignmentRule::isAddOnUpdateEnabled ( )

Definition at line 393 of file class.ilLDAPRoleAssignmentRule.php.

References $add_on_update.

Referenced by create(), and update().

394  {
395  return (bool) $this->add_on_update;
396  }
+ Here is the caller graph for this function:

◆ isGroupMember()

ilLDAPRoleAssignmentRule::isGroupMember (   $a_user_data)
private

Check if user is member of specific group.

private

Parameters
arrayuser data
arrayuser_data

Definition at line 138 of file class.ilLDAPRoleAssignmentRule.php.

References $query, $res, $server, array, getDN(), ilLDAPServer\getInstanceByServerId(), getMemberAttribute(), getServerId(), IL_LDAP_SCOPE_BASE, and isMemberAttributeDN().

Referenced by matches().

139  {
140  if ($this->isMemberAttributeDN()) {
141  $user_cmp = $a_user_data['dn'];
142  } else {
143  $user_cmp = $a_user_data['ilExternalAccount'];
144  }
145 
146  include_once('Services/LDAP/classes/class.ilLDAPQuery.php');
147  include_once('Services/LDAP/classes/class.ilLDAPServer.php');
148 
150 
151  try {
152  $query = new ilLDAPQuery($server);
153  $query->bind();
154  $res = $query->query(
155  $this->getDN(),
156  sprintf(
157  '(%s=%s)',
158  $this->getMemberAttribute(),
159  $user_cmp
160  ),
162  array('dn')
163  );
164  return $res->numRows() ? true : false;
165  } catch (ilLDAPQueryException $e) {
166  $this->logger->warning(': Caught Exception: ' . $e->getMessage());
167  return false;
168  }
169  }
isMemberAttributeDN()
is member attribute dn
static getInstanceByServerId($a_server_id)
Get instance by server id.
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
$server
Definition: getUserInfo.php:12
const IL_LDAP_SCOPE_BASE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isMemberAttributeDN()

ilLDAPRoleAssignmentRule::isMemberAttributeDN ( )

is member attribute dn

public

Definition at line 337 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by create(), isGroupMember(), and update().

338  {
339  return (bool) $this->member_is_dn;
340  }
+ Here is the caller graph for this function:

◆ isPluginActive()

ilLDAPRoleAssignmentRule::isPluginActive ( )

Definition at line 418 of file class.ilLDAPRoleAssignmentRule.php.

References getType().

419  {
420  return (bool) $this->getType() == self::TYPE_PLUGIN;
421  }
+ Here is the call graph for this function:

◆ isRemoveOnUpdateEnabled()

ilLDAPRoleAssignmentRule::isRemoveOnUpdateEnabled ( )

Definition at line 403 of file class.ilLDAPRoleAssignmentRule.php.

References $remove_on_update.

Referenced by create(), and update().

404  {
405  return (bool) $this->remove_on_update;
406  }
+ Here is the caller graph for this function:

◆ matches()

ilLDAPRoleAssignmentRule::matches (   $a_user_data)

Check if a rule matches.

Returns
Parameters
object$a_user_data

Definition at line 88 of file class.ilLDAPRoleAssignmentRule.php.

References ilObject\_lookupTitle(), array, ilLDAPRoleAssignmentRules\callPlugin(), getAttributeName(), getAttributeValue(), getPluginId(), getRoleId(), getType(), isGroupMember(), and wildcardCompare().

89  {
90  switch ($this->getType()) {
91  case self::TYPE_PLUGIN:
92  include_once './Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
93  return ilLDAPRoleAssignmentRules::callPlugin($this->getPluginId(), $a_user_data);
94 
95  case self::TYPE_ATTRIBUTE:
96 
97  $attn = strtolower($this->getAttributeName());
98 
99  if (!isset($a_user_data[$attn])) {
100  return false;
101  }
102 
103  if (!is_array($a_user_data[$attn])) {
104  $attribute_val = array(0 => $a_user_data[$attn]);
105  } else {
106  $attribute_val = $a_user_data[$attn];
107  }
108 
109  foreach ($attribute_val as $value) {
110  if ($this->wildcardCompare(trim($this->getAttributeValue()), trim($value))) {
111  $this->logger->debug(': Found role mapping: ' . ilObject::_lookupTitle($this->getRoleId()));
112  return true;
113  }
114  }
115  return false;
116 
117  case self::TYPE_GROUP:
118  return $this->isGroupMember($a_user_data);
119 
120  }
121  }
static _lookupTitle($a_id)
lookup object title
isGroupMember($a_user_data)
Check if user is member of specific group.
static callPlugin($a_plugin_id, $a_user_data)
Call plugin check if the condition matches.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ read()

ilLDAPRoleAssignmentRule::read ( )
private

load from db

private

Definition at line 575 of file class.ilLDAPRoleAssignmentRule.php.

References $db, $ilDB, $query, $res, $row, enableAddOnUpdate(), enableRemoveOnUpdate(), ilDBConstants\FETCHMODE_OBJECT, getRuleId(), setAttributeName(), setAttributeValue(), setDN(), setMemberAttribute(), setMemberIsDN(), setPluginId(), setRoleId(), setServerId(), and setType().

Referenced by __construct().

576  {
577  $ilDB = $this->db;
578 
579  $query = "SELECT * FROM ldap_role_assignments " .
580  "WHERE rule_id = " . $this->db->quote($this->getRuleId(), 'integer') . " ";
581 
582  $res = $this->db->query($query);
583  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
584  $this->setServerId($row->server_id);
585  $this->setType($row->type);
586  $this->setDN($row->dn);
587  $this->setMemberAttribute($row->attribute);
588  $this->setMemberIsDN($row->isdn);
589  $this->setAttributeName($row->att_name);
590  $this->setAttributeValue($row->att_value);
591  $this->setRoleId($row->role_id);
592  $this->enableAddOnUpdate($row->add_on_update);
593  $this->enableRemoveOnUpdate($row->remove_on_update);
594  $this->setPluginId($row->plugin_id);
595  }
596  }
setAttributeName($a_name)
set attribute name
setAttributeValue($a_value)
set attribute value
foreach($_POST as $key=> $value) $res
$query
global $ilDB
setMemberIsDN($a_status)
set member attribute is dn
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAttributeName()

ilLDAPRoleAssignmentRule::setAttributeName (   $a_name)

set attribute name

public

Parameters

Definition at line 349 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by read().

350  {
351  $this->attribute_name = $a_name;
352  }
+ Here is the caller graph for this function:

◆ setAttributeValue()

ilLDAPRoleAssignmentRule::setAttributeValue (   $a_value)

set attribute value

public

Parameters
stringvalue

Definition at line 372 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by read().

373  {
374  $this->attribute_value = $a_value;
375  }
+ Here is the caller graph for this function:

◆ setDN()

ilLDAPRoleAssignmentRule::setDN (   $a_dn)

set dn

public

Parameters
stringdn

Definition at line 280 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by read().

281  {
282  $this->dn = $a_dn;
283  }
+ Here is the caller graph for this function:

◆ setMemberAttribute()

ilLDAPRoleAssignmentRule::setMemberAttribute (   $a_attribute)

public

Parameters

Definition at line 303 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by read().

304  {
305  $this->member_attribute = $a_attribute;
306  }
+ Here is the caller graph for this function:

◆ setMemberIsDN()

ilLDAPRoleAssignmentRule::setMemberIsDN (   $a_status)

set member attribute is dn

public

Parameters
boolstatus

Definition at line 326 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by read().

327  {
328  $this->member_is_dn = $a_status;
329  }
+ Here is the caller graph for this function:

◆ setPluginId()

ilLDAPRoleAssignmentRule::setPluginId (   $a_id)

Definition at line 408 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by read().

409  {
410  $this->plugin_id = $a_id;
411  }
+ Here is the caller graph for this function:

◆ setRoleId()

ilLDAPRoleAssignmentRule::setRoleId (   $a_role_id)

set role id

public

Parameters
introle id of global role

Definition at line 199 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by read().

200  {
201  $this->role_id = $a_role_id;
202  }
+ Here is the caller graph for this function:

◆ setServerId()

ilLDAPRoleAssignmentRule::setServerId (   $a_id)

set server id

public

Parameters
intserver id

Definition at line 233 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by read().

234  {
235  $this->server_id = $a_id;
236  }
+ Here is the caller graph for this function:

◆ setType()

ilLDAPRoleAssignmentRule::setType (   $a_type)

set type

public

Parameters
inttype

Definition at line 256 of file class.ilLDAPRoleAssignmentRule.php.

References $a_type.

Referenced by read().

257  {
258  $this->type = $a_type;
259  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ update()

ilLDAPRoleAssignmentRule::update ( )

update

public

Definition at line 489 of file class.ilLDAPRoleAssignmentRule.php.

References $db, $ilDB, $query, $res, getAttributeName(), getAttributeValue(), getDN(), getMemberAttribute(), getPluginId(), getRoleId(), getRuleId(), getServerId(), getType(), isAddOnUpdateEnabled(), isMemberAttributeDN(), and isRemoveOnUpdateEnabled().

490  {
491  $ilDB = $this->db;
492 
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') . ", " .
497  "attribute = " . $this->db->quote($this->getMemberAttribute(), 'text') . ", " .
498  "isdn = " . $this->db->quote($this->isMemberAttributeDN(), 'integer') . ", " .
499  "att_name = " . $this->db->quote($this->getAttributeName(), 'text') . ", " .
500  "att_value = " . $this->db->quote($this->getAttributeValue(), 'text') . ", " .
501  "role_id = " . $this->db->quote($this->getRoleId(), 'integer') . ", " .
502  "add_on_update = " . $this->db->quote($this->isAddOnUpdateEnabled(), 'integer') . ', ' .
503  'remove_on_update = ' . $this->db->quote($this->isRemoveOnUpdateEnabled(), 'integer') . ', ' .
504  'plugin_id = ' . $this->db->quote($this->getPluginId(), 'integer') . ' ' .
505  "WHERE rule_id = " . $this->db->quote($this->getRuleId(), 'integer') . " ";
506  $res = $ilDB->manipulate($query);
507  return true;
508  }
isMemberAttributeDN()
is member attribute dn
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ validate()

ilLDAPRoleAssignmentRule::validate ( )

validate

public

Definition at line 516 of file class.ilLDAPRoleAssignmentRule.php.

References $ilErr, getAttributeName(), getAttributeValue(), getDN(), getMemberAttribute(), getPluginId(), getRoleId(), and getType().

517  {
518  global $ilErr;
519 
520  $ilErr->setMessage('');
521 
522  if (!$this->getRoleId()) {
523  $ilErr->setMessage('fill_out_all_required_fields');
524  return false;
525  }
526  switch ($this->getType()) {
527  case self::TYPE_GROUP:
528  if (!strlen($this->getDN()) or !strlen($this->getMemberAttribute())) {
529  $ilErr->setMessage('fill_out_all_required_fields');
530  return false;
531  }
532  break;
533  case self::TYPE_ATTRIBUTE:
534  if (!strlen($this->getAttributeName()) or !strlen($this->getAttributeValue())) {
535  $ilErr->setMessage('fill_out_all_required_fields');
536  return false;
537  }
538  break;
539 
540  case self::TYPE_PLUGIN:
541  if (!$this->getPluginId()) {
542  $ilErr->setMessage('ldap_err_missing_plugin_id');
543  return false;
544  }
545  break;
546 
547  default:
548  $ilErr->setMessage('ldap_no_type_given');
549  return false;
550  }
551  return true;
552  }
global $ilErr
Definition: raiseError.php:16
+ Here is the call graph for this function:

◆ wildcardCompare()

ilLDAPRoleAssignmentRule::wildcardCompare (   $a_str1,
  $a_str2 
)
protected

Definition at line 123 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by matches().

124  {
125  $pattern = str_replace('*', '.*?', $a_str1);
126  $this->logger->debug(': Replace pattern:' . $pattern . ' => ' . $a_str2);
127  return (bool) preg_match('/^' . $pattern . '$/i', $a_str2);
128  }
+ Here is the caller graph for this function:

Field Documentation

◆ $add_on_update

ilLDAPRoleAssignmentRule::$add_on_update = false
private

Definition at line 30 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by isAddOnUpdateEnabled().

◆ $db

ilLDAPRoleAssignmentRule::$db = null
private

Definition at line 22 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by create(), delete(), read(), and update().

◆ $instances

ilLDAPRoleAssignmentRule::$instances = null
staticprivate

Definition at line 12 of file class.ilLDAPRoleAssignmentRule.php.

◆ $logger

ilLDAPRoleAssignmentRule::$logger = null
private

Definition at line 17 of file class.ilLDAPRoleAssignmentRule.php.

◆ $plugin_active

ilLDAPRoleAssignmentRule::$plugin_active = false
private

Definition at line 29 of file class.ilLDAPRoleAssignmentRule.php.

◆ $plugin_id

ilLDAPRoleAssignmentRule::$plugin_id = 0
private

Definition at line 32 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by getPluginId().

◆ $remove_on_update

ilLDAPRoleAssignmentRule::$remove_on_update = false
private

Definition at line 31 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by isRemoveOnUpdateEnabled().

◆ $server_id

ilLDAPRoleAssignmentRule::$server_id = 0
private

Definition at line 28 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by getServerId().

◆ TYPE_ATTRIBUTE

const ilLDAPRoleAssignmentRule::TYPE_ATTRIBUTE = 2

◆ TYPE_GROUP

const ilLDAPRoleAssignmentRule::TYPE_GROUP = 1

◆ TYPE_PLUGIN

const ilLDAPRoleAssignmentRule::TYPE_PLUGIN = 3

The documentation for this class was generated from the following file: