ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ 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 182 of file class.ilLDAPRoleAssignmentRule.php.

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

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

183  {
184  $ilDB = $GLOBALS['DIC']->database();
185 
186  $query = "SELECT rule_id FROM ldap_role_assignments " .
187  "WHERE server_id = " . $ilDB->quote($a_server_id, 'integer');
188  $res = $ilDB->query($query);
189  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
190  $rules[] = self::_getInstanceByRuleId($row->rule_id);
191  }
192  return $rules ? $rules : array();
193  }
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the caller graph for this function:

◆ conditionToString()

ilLDAPRoleAssignmentRule::conditionToString ( )

condition to string

public

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

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

434  {
435  $lng = $GLOBALS['DIC']->language();
436 
437  switch ($this->getType()) {
438  case self::TYPE_PLUGIN:
439  return $lng->txt('ldap_plugin_id') . ': ' . $this->getPluginId();
440 
441  case self::TYPE_GROUP:
442  $dn_arr = explode(',', $this->getDN());
443  return $dn_arr[0];
444 
445 
446  case self::TYPE_ATTRIBUTE:
447  return $this->getAttributeName() . '=' . $this->getAttributeValue();
448  }
449  }
$lng
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

◆ create()

ilLDAPRoleAssignmentRule::create ( )

create

public

Parameters

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

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

460  {
461  $ilDB = $this->db;
462  $next_id = $ilDB->nextId('ldap_role_assignments');
463 
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 ) " .
466  "VALUES( " .
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') . ", " .
471  $this->db->quote($this->getMemberAttribute(), 'text') . ", " .
472  $this->db->quote($this->isMemberAttributeDN(), 'integer') . ", " .
473  $this->db->quote($this->getAttributeName(), 'text') . ", " .
474  $this->db->quote($this->getAttributeValue(), 'text') . ", " .
475  $this->db->quote($this->getRoleId(), 'integer') . ", " .
476  $this->db->quote($this->isAddOnUpdateEnabled(), 'integer') . ', ' .
477  $this->db->quote($this->isRemoveOnUpdateEnabled(), 'integer') . ', ' .
478  $this->db->quote($this->getPluginId(), 'integer') . ' ' .
479  ")";
480  $res = $ilDB->manipulate($query);
481  $this->rule_id = $next_id;
482 
483  return true;
484  }
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 565 of file class.ilLDAPRoleAssignmentRule.php.

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

566  {
567  $ilDB = $this->db;
568 
569  $query = "DELETE FROM ldap_role_assignments " .
570  "WHERE rule_id = " . $this->db->quote($this->getRuleId(), 'integer') . " ";
571  $res = $ilDB->manipulate($query);
572  return true;
573  }
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 391 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by read().

392  {
393  $this->add_on_update = $a_status;
394  }
+ Here is the caller graph for this function:

◆ enableRemoveOnUpdate()

ilLDAPRoleAssignmentRule::enableRemoveOnUpdate (   $a_status)

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

Referenced by read().

402  {
403  $this->remove_on_update = $a_status;
404  }
+ Here is the caller graph for this function:

◆ getAttributeName()

ilLDAPRoleAssignmentRule::getAttributeName ( )

get attribute name

public

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

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

364  {
365  return $this->attribute_name;
366  }
+ Here is the caller graph for this function:

◆ getAttributeValue()

ilLDAPRoleAssignmentRule::getAttributeValue ( )

get atrtibute value

public

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

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

387  {
388  return $this->attribute_value;
389  }
+ Here is the caller graph for this function:

◆ getDN()

ilLDAPRoleAssignmentRule::getDN ( )

get dn

public

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

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

295  {
296  return $this->dn;
297  }
+ Here is the caller graph for this function:

◆ getMemberAttribute()

ilLDAPRoleAssignmentRule::getMemberAttribute ( )

get attribute

public

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

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

318  {
319  return $this->member_attribute;
320  }
+ Here is the caller graph for this function:

◆ getPluginId()

ilLDAPRoleAssignmentRule::getPluginId ( )

Definition at line 416 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 213 of file class.ilLDAPRoleAssignmentRule.php.

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

214  {
215  return $this->role_id;
216  }
+ Here is the caller graph for this function:

◆ getRuleId()

ilLDAPRoleAssignmentRule::getRuleId ( )

get id

public

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

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

225  {
226  return $this->rule_id;
227  }
+ Here is the caller graph for this function:

◆ getServerId()

ilLDAPRoleAssignmentRule::getServerId ( )

get server id

public

Definition at line 247 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 271 of file class.ilLDAPRoleAssignmentRule.php.

References $type.

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

272  {
273  return $this->type;
274  }
$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 $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilLDAPUserSynchronisation\isUpdateRequired().

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

◆ isAddOnUpdateEnabled()

ilLDAPRoleAssignmentRule::isAddOnUpdateEnabled ( )

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

References $add_on_update.

Referenced by create(), and update().

397  {
398  return (bool) $this->add_on_update;
399  }
+ 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 140 of file class.ilLDAPRoleAssignmentRule.php.

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

Referenced by matches().

141  {
143 
144  if ($this->isMemberAttributeDN()) {
145  if ($server->enabledEscapeDN()) {
146  $user_cmp = ldap_escape($a_user_data['dn'], "", LDAP_ESCAPE_FILTER);
147  } else {
148  $user_cmp = $a_user_data['dn'];
149  }
150  } else {
151  $user_cmp = $a_user_data['ilExternalAccount'];
152  }
153 
154  try {
155  $query = new ilLDAPQuery($server);
156  $query->bind();
157  $res = $query->query(
158  $this->getDN(),
159  sprintf(
160  '(%s=%s)',
161  $this->getMemberAttribute(),
162  $user_cmp
163  ),
165  array('dn')
166  );
167  return $res->numRows() ? true : false;
168  } catch (ilLDAPQueryException $e) {
169  $this->logger->warning(': Caught Exception: ' . $e->getMessage());
170  return false;
171  }
172  }
isMemberAttributeDN()
is member attribute dn
$server
Definition: sabredav.php:48
static getInstanceByServerId($a_server_id)
Get instance by server id.
foreach($_POST as $key=> $value) $res
$query
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 340 of file class.ilLDAPRoleAssignmentRule.php.

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

341  {
342  return (bool) $this->member_is_dn;
343  }
+ Here is the caller graph for this function:

◆ isPluginActive()

ilLDAPRoleAssignmentRule::isPluginActive ( )

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

References getType().

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

◆ isRemoveOnUpdateEnabled()

ilLDAPRoleAssignmentRule::isRemoveOnUpdateEnabled ( )

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

References $remove_on_update.

Referenced by create(), and update().

407  {
408  return (bool) $this->remove_on_update;
409  }
+ 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 90 of file class.ilLDAPRoleAssignmentRule.php.

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

91  {
92  switch ($this->getType()) {
93  case self::TYPE_PLUGIN:
94  include_once './Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
95  return ilLDAPRoleAssignmentRules::callPlugin($this->getPluginId(), $a_user_data);
96 
97  case self::TYPE_ATTRIBUTE:
98 
99  $attn = strtolower($this->getAttributeName());
100 
101  if (!isset($a_user_data[$attn])) {
102  return false;
103  }
104 
105  if (!is_array($a_user_data[$attn])) {
106  $attribute_val = array(0 => $a_user_data[$attn]);
107  } else {
108  $attribute_val = $a_user_data[$attn];
109  }
110 
111  foreach ($attribute_val as $value) {
112  if ($this->wildcardCompare(trim($this->getAttributeValue()), trim($value))) {
113  $this->logger->debug(': Found role mapping: ' . ilObject::_lookupTitle($this->getRoleId()));
114  return true;
115  }
116  }
117  return false;
118 
119  case self::TYPE_GROUP:
120  return $this->isGroupMember($a_user_data);
121 
122  }
123  }
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.
+ Here is the call graph for this function:

◆ read()

ilLDAPRoleAssignmentRule::read ( )
private

load from db

private

Definition at line 580 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().

581  {
582  $ilDB = $this->db;
583 
584  $query = "SELECT * FROM ldap_role_assignments " .
585  "WHERE rule_id = " . $this->db->quote($this->getRuleId(), 'integer') . " ";
586 
587  $res = $this->db->query($query);
588  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
589  $this->setServerId($row->server_id);
590  $this->setType($row->type);
591  $this->setDN($row->dn);
592  $this->setMemberAttribute($row->attribute);
593  $this->setMemberIsDN($row->isdn);
594  $this->setAttributeName($row->att_name);
595  $this->setAttributeValue($row->att_value);
596  $this->setRoleId($row->role_id);
597  $this->enableAddOnUpdate($row->add_on_update);
598  $this->enableRemoveOnUpdate($row->remove_on_update);
599  $this->setPluginId($row->plugin_id);
600  }
601  }
setAttributeName($a_name)
set attribute name
setAttributeValue($a_value)
set attribute value
foreach($_POST as $key=> $value) $res
$query
$row
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 352 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by read().

353  {
354  $this->attribute_name = $a_name;
355  }
+ Here is the caller graph for this function:

◆ setAttributeValue()

ilLDAPRoleAssignmentRule::setAttributeValue (   $a_value)

set attribute value

public

Parameters
stringvalue

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

Referenced by read().

376  {
377  $this->attribute_value = $a_value;
378  }
+ Here is the caller graph for this function:

◆ setDN()

ilLDAPRoleAssignmentRule::setDN (   $a_dn)

set dn

public

Parameters
stringdn

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

Referenced by read().

284  {
285  $this->dn = $a_dn;
286  }
+ Here is the caller graph for this function:

◆ setMemberAttribute()

ilLDAPRoleAssignmentRule::setMemberAttribute (   $a_attribute)

public

Parameters

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

Referenced by read().

307  {
308  $this->member_attribute = $a_attribute;
309  }
+ Here is the caller graph for this function:

◆ setMemberIsDN()

ilLDAPRoleAssignmentRule::setMemberIsDN (   $a_status)

set member attribute is dn

public

Parameters
boolstatus

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

Referenced by read().

330  {
331  $this->member_is_dn = $a_status;
332  }
+ Here is the caller graph for this function:

◆ setPluginId()

ilLDAPRoleAssignmentRule::setPluginId (   $a_id)

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

Referenced by read().

412  {
413  $this->plugin_id = $a_id;
414  }
+ 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 202 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by read().

203  {
204  $this->role_id = $a_role_id;
205  }
+ Here is the caller graph for this function:

◆ setServerId()

ilLDAPRoleAssignmentRule::setServerId (   $a_id)

set server id

public

Parameters
intserver id

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

Referenced by read().

237  {
238  $this->server_id = $a_id;
239  }
+ Here is the caller graph for this function:

◆ setType()

ilLDAPRoleAssignmentRule::setType (   $a_type)

set type

public

Parameters
inttype

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

References $a_type.

Referenced by read().

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

◆ update()

ilLDAPRoleAssignmentRule::update ( )

update

public

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

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

493  {
494  $ilDB = $this->db;
495 
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') . ", " .
500  "attribute = " . $this->db->quote($this->getMemberAttribute(), 'text') . ", " .
501  "isdn = " . $this->db->quote($this->isMemberAttributeDN(), 'integer') . ", " .
502  "att_name = " . $this->db->quote($this->getAttributeName(), 'text') . ", " .
503  "att_value = " . $this->db->quote($this->getAttributeValue(), 'text') . ", " .
504  "role_id = " . $this->db->quote($this->getRoleId(), 'integer') . ", " .
505  "add_on_update = " . $this->db->quote($this->isAddOnUpdateEnabled(), 'integer') . ', ' .
506  'remove_on_update = ' . $this->db->quote($this->isRemoveOnUpdateEnabled(), 'integer') . ', ' .
507  'plugin_id = ' . $this->db->quote($this->getPluginId(), 'integer') . ' ' .
508  "WHERE rule_id = " . $this->db->quote($this->getRuleId(), 'integer') . " ";
509  $res = $ilDB->manipulate($query);
510  return true;
511  }
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 519 of file class.ilLDAPRoleAssignmentRule.php.

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

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

◆ wildcardCompare()

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

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

Referenced by matches().

126  {
127  $pattern = str_replace('*', '.*?', $a_str1);
128  $this->logger->debug(': Replace pattern:' . $pattern . ' => ' . $a_str2);
129  return (bool) preg_match('/^' . $pattern . '$/i', $a_str2);
130  }
+ 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: