ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLDAPRoleAssignmentRule Class Reference
+ Collaboration diagram for ilLDAPRoleAssignmentRule:

Public Member Functions

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

Static Public Member Functions

static _getInstanceByRuleId (int $a_rule_id)
 
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 (string $a_str1, string $a_str2)
 

Private Member Functions

 __construct (int $a_rule_id=0)
 
 isGroupMember (array $a_user_data)
 Check if user is member of specific group. More...
 
 read ()
 

Private Attributes

ilLogger $logger
 
ilDBInterface $db
 
ilErrorHandling $ilErr
 
ilLanguage $lng
 
int $rule_id
 
int $server_id = 0
 
bool $add_on_update = false
 
bool $remove_on_update = false
 
int $plugin_id = 0
 
string $attribute_value = ''
 
string $attribute_name = ''
 
bool $member_is_dn = false
 
string $member_attribute = ''
 
string $dn = ''
 
int $type = 0
 
int $role_id = 0
 

Static Private Attributes

static array $instances = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLDAPRoleAssignmentRule::__construct ( int  $a_rule_id = 0)
private

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

References $DIC, ILIAS\Repository\lng(), ILIAS\Repository\logger(), and read().

53  {
54  global $DIC;
55  $this->db = $DIC->database();
56  $this->logger = $DIC->logger()->auth();
57  $this->ilErr = $DIC['ilErr'];
58  $this->lng = $DIC->language();
59 
60  $this->rule_id = $a_rule_id;
61  $this->read();
62  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ _getInstanceByRuleId()

static ilLDAPRoleAssignmentRule::_getInstanceByRuleId ( int  $a_rule_id)
static

◆ _getRules()

static ilLDAPRoleAssignmentRule::_getRules (   $a_server_id)
static

Get all rules.

Returns
ilLDAPRoleAssignmentRule[]

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

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

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

180  : array
181  {
182  global $DIC;
183  $ilDB = $DIC->database();
184 
185  $rules = [];
186 
187  $query = "SELECT rule_id FROM ldap_role_assignments " .
188  "WHERE server_id = " . $ilDB->quote($a_server_id, 'integer');
189  $res = $ilDB->query($query);
190  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
191  $rules[] = self::_getInstanceByRuleId((int) $row->rule_id);
192  }
193 
194  return $rules;
195  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
+ Here is the caller graph for this function:

◆ conditionToString()

ilLDAPRoleAssignmentRule::conditionToString ( )

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

References getAttributeName(), getAttributeValue(), getDN(), getPluginId(), getType(), and ILIAS\Repository\lng().

Referenced by ilLDAPSettingsGUI\confirmDeleteRules().

367  : string
368  {
369  switch ($this->getType()) {
370  case self::TYPE_PLUGIN:
371  return $this->lng->txt('ldap_plugin_id') . ': ' . $this->getPluginId();
372 
373  case self::TYPE_GROUP:
374  $dn_arr = explode(',', $this->getDN());
375  return $dn_arr[0];
376 
377  case self::TYPE_ATTRIBUTE:
378  return $this->getAttributeName() . '=' . $this->getAttributeValue();
379 
380  default:
381  throw new RuntimeException(sprintf('Unknown type: %s', var_export($this->getType(), true)));
382  }
383  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

ilLDAPRoleAssignmentRule::create ( )

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

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

385  : bool
386  {
387  $next_id = $this->db->nextId('ldap_role_assignments');
388 
389  $query = "INSERT INTO ldap_role_assignments (server_id,rule_id,type,dn,attribute,isdn,att_name,att_value,role_id, " .
390  "add_on_update, remove_on_update, plugin_id ) " .
391  "VALUES( " .
392  $this->db->quote($this->getServerId(), 'integer') . ", " .
393  $this->db->quote($next_id, 'integer') . ", " .
394  $this->db->quote($this->getType(), 'integer') . ", " .
395  $this->db->quote($this->getDN(), 'text') . ", " .
396  $this->db->quote($this->getMemberAttribute(), 'text') . ", " .
397  $this->db->quote($this->isMemberAttributeDN(), 'integer') . ", " .
398  $this->db->quote($this->getAttributeName(), 'text') . ", " .
399  $this->db->quote($this->getAttributeValue(), 'text') . ", " .
400  $this->db->quote($this->getRoleId(), 'integer') . ", " .
401  $this->db->quote($this->isAddOnUpdateEnabled(), 'integer') . ', ' .
402  $this->db->quote($this->isRemoveOnUpdateEnabled(), 'integer') . ', ' .
403  $this->db->quote($this->getPluginId(), 'integer') . ' ' .
404  ")";
405  $this->db->manipulate($query);
406  $this->rule_id = $next_id;
407 
408  return true;
409  }
isMemberAttributeDN()
is member attribute dn
$query
+ Here is the call graph for this function:

◆ delete()

ilLDAPRoleAssignmentRule::delete ( )

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

References $query, and getRuleId().

Referenced by ilLDAPSettingsGUI\deleteRules().

468  : bool
469  {
470  $query = "DELETE FROM ldap_role_assignments " .
471  "WHERE rule_id = " . $this->db->quote($this->getRuleId(), 'integer') . " ";
472  $this->db->manipulate($query);
473 
474  return true;
475  }
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enableAddOnUpdate()

ilLDAPRoleAssignmentRule::enableAddOnUpdate ( bool  $a_status)

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

Referenced by read().

332  : void
333  {
334  $this->add_on_update = $a_status;
335  }
+ Here is the caller graph for this function:

◆ enableRemoveOnUpdate()

ilLDAPRoleAssignmentRule::enableRemoveOnUpdate ( bool  $a_status)

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

Referenced by read().

342  : void
343  {
344  $this->remove_on_update = $a_status;
345  }
+ Here is the caller graph for this function:

◆ getAttributeName()

ilLDAPRoleAssignmentRule::getAttributeName ( )

get attribute name

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

References $attribute_name.

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

311  : string
312  {
313  return $this->attribute_name;
314  }
+ Here is the caller graph for this function:

◆ getAttributeValue()

ilLDAPRoleAssignmentRule::getAttributeValue ( )

get atrtibute value

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

References $attribute_value.

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

327  : string
328  {
329  return $this->attribute_value;
330  }
+ Here is the caller graph for this function:

◆ getDN()

ilLDAPRoleAssignmentRule::getDN ( )

get dn

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

References $dn.

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

266  : string
267  {
268  return $this->dn;
269  }
+ Here is the caller graph for this function:

◆ getMemberAttribute()

ilLDAPRoleAssignmentRule::getMemberAttribute ( )

get attribute

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

References $member_attribute.

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

279  : string
280  {
282  }
+ Here is the caller graph for this function:

◆ getPluginId()

ilLDAPRoleAssignmentRule::getPluginId ( )

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

References $plugin_id.

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

357  : int
358  {
359  return $this->plugin_id;
360  }
+ Here is the caller graph for this function:

◆ getRoleId()

ilLDAPRoleAssignmentRule::getRoleId ( )

get role id

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

References $role_id.

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

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

◆ getRuleId()

ilLDAPRoleAssignmentRule::getRuleId ( )

get id

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

References $rule_id.

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

218  : int
219  {
220  return $this->rule_id;
221  }
+ Here is the caller graph for this function:

◆ getServerId()

ilLDAPRoleAssignmentRule::getServerId ( )

get server id

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

References $server_id.

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

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

◆ getType()

ilLDAPRoleAssignmentRule::getType ( )

getType

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

References $type.

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

250  : int
251  {
252  return $this->type;
253  }
+ Here is the caller graph for this function:

◆ hasRulesForUpdate()

static ilLDAPRoleAssignmentRule::hasRulesForUpdate ( )
static

Check if there any rule for updates.

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

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

Referenced by ilLDAPUserSynchronisation\isUpdateRequired().

72  : bool
73  {
74  global $DIC;
75 
76  $ilDB = $DIC['ilDB'];
77 
78  $query = 'SELECT COUNT(*) num FROM ldap_role_assignments ' .
79  'WHERE add_on_update = 1 ' .
80  'OR remove_on_update = 1 ';
81  $res = $ilDB->query($query);
82  $row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
83 
84  return $row->num > 0;
85  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
+ Here is the caller graph for this function:

◆ isAddOnUpdateEnabled()

ilLDAPRoleAssignmentRule::isAddOnUpdateEnabled ( )

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

References $add_on_update.

Referenced by create(), and update().

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

◆ isGroupMember()

ilLDAPRoleAssignmentRule::isGroupMember ( array  $a_user_data)
private

Check if user is member of specific group.

Parameters
array$a_user_datauser_data

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

References Vendor\Package\$e, $query, $res, $server, getDN(), ilLDAPServer\getInstanceByServerId(), getMemberAttribute(), getServerId(), isMemberAttributeDN(), ilLDAPServer\LDAP_SCOPE_BASE, and ILIAS\Repository\logger().

Referenced by matches().

139  : bool
140  {
142 
143  if ($this->isMemberAttributeDN()) {
144  if ($server->enabledEscapeDN()) {
145  $user_cmp = ldap_escape($a_user_data['dn'], "", LDAP_ESCAPE_FILTER);
146  } else {
147  $user_cmp = $a_user_data['dn'];
148  }
149  } else {
150  $user_cmp = $a_user_data['ilExternalAccount'];
151  }
152 
153  try {
154  $query = new ilLDAPQuery($server);
155  $query->bind();
156  $res = $query->query(
157  $this->getDN(),
158  sprintf(
159  '(%s=%s)',
160  $this->getMemberAttribute(),
161  $user_cmp
162  ),
164  array('dn')
165  );
166  return (bool) $res->numRows();
167  } catch (ilLDAPQueryException $e) {
168  $this->logger->warning(': Caught Exception: ' . $e->getMessage());
169  return false;
170  }
171  }
$res
Definition: ltiservices.php:69
static getInstanceByServerId(int $a_server_id)
Get instance by server id.
isMemberAttributeDN()
is member attribute dn
$query
$server
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isMemberAttributeDN()

ilLDAPRoleAssignmentRule::isMemberAttributeDN ( )

is member attribute dn

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

References $member_is_dn.

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

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

◆ isPluginActive()

ilLDAPRoleAssignmentRule::isPluginActive ( )

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

References getType().

362  : bool
363  {
364  return $this->getType() === self::TYPE_PLUGIN;
365  }
+ Here is the call graph for this function:

◆ isRemoveOnUpdateEnabled()

ilLDAPRoleAssignmentRule::isRemoveOnUpdateEnabled ( )

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

References $remove_on_update.

Referenced by create(), and update().

347  : bool
348  {
350  }
+ Here is the caller graph for this function:

◆ matches()

ilLDAPRoleAssignmentRule::matches ( array  $a_user_data)

Check if a rule matches.

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

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

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

◆ read()

ilLDAPRoleAssignmentRule::read ( )
private

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

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

Referenced by __construct().

477  : void
478  {
479  $query = "SELECT * FROM ldap_role_assignments " .
480  "WHERE rule_id = " . $this->db->quote($this->getRuleId(), 'integer') . " ";
481 
482  $res = $this->db->query($query);
483  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
484  $this->setServerId((int) $row->server_id);
485  $this->setType((int) $row->type);
486  if (!is_null($row->dn)) {
487  $this->setDN($row->dn);
488  }
489  if (!is_null($row->attribute)) {
490  $this->setMemberAttribute($row->attribute);
491  }
492  $this->setMemberIsDN((bool) $row->isdn);
493  if (!is_null($row->att_name)) {
494  $this->setAttributeName($row->att_name);
495  }
496  if (!is_null($row->att_value)) {
497  $this->setAttributeValue($row->att_value);
498  }
499  $this->setRoleId((int) $row->role_id);
500  if (!is_null($row->add_on_update)) {
501  $this->enableAddOnUpdate((bool) $row->add_on_update);
502  }
503  if (!is_null($row->remove_on_update)) {
504  $this->enableRemoveOnUpdate((bool) $row->remove_on_update);
505  }
506  if (!is_null($row->plugin_id)) {
507  $this->setPluginId((int) $row->plugin_id);
508  }
509  }
510  }
$res
Definition: ltiservices.php:69
setAttributeName(string $a_name)
set attribute name
setAttributeValue(string $a_value)
set attribute value
$query
setRoleId(int $a_role_id)
set role id
setMemberIsDN(bool $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 ( string  $a_name)

set attribute name

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

Referenced by read().

303  : void
304  {
305  $this->attribute_name = $a_name;
306  }
+ Here is the caller graph for this function:

◆ setAttributeValue()

ilLDAPRoleAssignmentRule::setAttributeValue ( string  $a_value)

set attribute value

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

Referenced by read().

319  : void
320  {
321  $this->attribute_value = $a_value;
322  }
+ Here is the caller graph for this function:

◆ setDN()

ilLDAPRoleAssignmentRule::setDN ( string  $a_dn)

set dn

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

Referenced by read().

258  : void
259  {
260  $this->dn = $a_dn;
261  }
+ Here is the caller graph for this function:

◆ setMemberAttribute()

ilLDAPRoleAssignmentRule::setMemberAttribute ( string  $a_attribute)

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

Referenced by read().

271  : void
272  {
273  $this->member_attribute = $a_attribute;
274  }
+ Here is the caller graph for this function:

◆ setMemberIsDN()

ilLDAPRoleAssignmentRule::setMemberIsDN ( bool  $a_status)

set member attribute is dn

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

Referenced by read().

287  : void
288  {
289  $this->member_is_dn = $a_status;
290  }
+ Here is the caller graph for this function:

◆ setPluginId()

ilLDAPRoleAssignmentRule::setPluginId ( int  $a_id)

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

Referenced by read().

352  : void
353  {
354  $this->plugin_id = $a_id;
355  }
+ Here is the caller graph for this function:

◆ setRoleId()

ilLDAPRoleAssignmentRule::setRoleId ( int  $a_role_id)

set role id

Parameters
int$a_role_idrole id of global role

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

Referenced by read().

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

◆ setServerId()

ilLDAPRoleAssignmentRule::setServerId ( int  $a_id)

set server id

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

Referenced by read().

226  : void
227  {
228  $this->server_id = $a_id;
229  }
+ Here is the caller graph for this function:

◆ setType()

ilLDAPRoleAssignmentRule::setType ( int  $a_type)

set type

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

Referenced by read().

242  : void
243  {
244  $this->type = $a_type;
245  }
+ Here is the caller graph for this function:

◆ update()

ilLDAPRoleAssignmentRule::update ( )

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

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

411  : bool
412  {
413  $query = "UPDATE ldap_role_assignments " .
414  "SET server_id = " . $this->db->quote($this->getServerId(), 'integer') . ", " .
415  "type = " . $this->db->quote($this->getType(), 'integer') . ", " .
416  "dn = " . $this->db->quote($this->getDN(), 'text') . ", " .
417  "attribute = " . $this->db->quote($this->getMemberAttribute(), 'text') . ", " .
418  "isdn = " . $this->db->quote($this->isMemberAttributeDN(), 'integer') . ", " .
419  "att_name = " . $this->db->quote($this->getAttributeName(), 'text') . ", " .
420  "att_value = " . $this->db->quote($this->getAttributeValue(), 'text') . ", " .
421  "role_id = " . $this->db->quote($this->getRoleId(), 'integer') . ", " .
422  "add_on_update = " . $this->db->quote($this->isAddOnUpdateEnabled(), 'integer') . ', ' .
423  'remove_on_update = ' . $this->db->quote($this->isRemoveOnUpdateEnabled(), 'integer') . ', ' .
424  'plugin_id = ' . $this->db->quote($this->getPluginId(), 'integer') . ' ' .
425  "WHERE rule_id = " . $this->db->quote($this->getRuleId(), 'integer') . " ";
426  $this->db->manipulate($query);
427 
428  return true;
429  }
isMemberAttributeDN()
is member attribute dn
$query
+ Here is the call graph for this function:

◆ validate()

ilLDAPRoleAssignmentRule::validate ( )

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

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

431  : bool
432  {
433  $this->ilErr->setMessage('');
434 
435  if (!$this->getRoleId()) {
436  $this->ilErr->setMessage('fill_out_all_required_fields');
437  return false;
438  }
439  switch ($this->getType()) {
440  case self::TYPE_GROUP:
441  if ($this->getDN() === '' || $this->getMemberAttribute() === '') {
442  $this->ilErr->setMessage('fill_out_all_required_fields');
443  return false;
444  }
445  break;
446  case self::TYPE_ATTRIBUTE:
447  if ($this->getAttributeName() === '' || $this->getAttributeValue() === '') {
448  $this->ilErr->setMessage('fill_out_all_required_fields');
449  return false;
450  }
451  break;
452 
453  case self::TYPE_PLUGIN:
454  if (!$this->getPluginId()) {
455  $this->ilErr->setMessage('ldap_err_missing_plugin_id');
456  return false;
457  }
458  break;
459 
460  default:
461  $this->ilErr->setMessage('ldap_no_type_given');
462  return false;
463  }
464 
465  return true;
466  }
+ Here is the call graph for this function:

◆ wildcardCompare()

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

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

References ILIAS\Repository\logger().

Referenced by matches().

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

Field Documentation

◆ $add_on_update

bool ilLDAPRoleAssignmentRule::$add_on_update = false
private

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

Referenced by isAddOnUpdateEnabled().

◆ $attribute_name

string ilLDAPRoleAssignmentRule::$attribute_name = ''
private

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

Referenced by getAttributeName().

◆ $attribute_value

string ilLDAPRoleAssignmentRule::$attribute_value = ''
private

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

Referenced by getAttributeValue().

◆ $db

ilDBInterface ilLDAPRoleAssignmentRule::$db
private

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

◆ $dn

string ilLDAPRoleAssignmentRule::$dn = ''
private

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

Referenced by getDN().

◆ $ilErr

ilErrorHandling ilLDAPRoleAssignmentRule::$ilErr
private

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

◆ $instances

array ilLDAPRoleAssignmentRule::$instances = []
staticprivate

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

◆ $lng

ilLanguage ilLDAPRoleAssignmentRule::$lng
private

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

◆ $logger

ilLogger ilLDAPRoleAssignmentRule::$logger
private

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

◆ $member_attribute

string ilLDAPRoleAssignmentRule::$member_attribute = ''
private

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

Referenced by getMemberAttribute().

◆ $member_is_dn

bool ilLDAPRoleAssignmentRule::$member_is_dn = false
private

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

Referenced by isMemberAttributeDN().

◆ $plugin_id

int ilLDAPRoleAssignmentRule::$plugin_id = 0
private

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

Referenced by getPluginId().

◆ $remove_on_update

bool ilLDAPRoleAssignmentRule::$remove_on_update = false
private

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

Referenced by isRemoveOnUpdateEnabled().

◆ $role_id

int ilLDAPRoleAssignmentRule::$role_id = 0
private

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

Referenced by getRoleId().

◆ $rule_id

int ilLDAPRoleAssignmentRule::$rule_id
private

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

Referenced by getRuleId().

◆ $server_id

int ilLDAPRoleAssignmentRule::$server_id = 0
private

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

Referenced by getServerId().

◆ $type

int ilLDAPRoleAssignmentRule::$type = 0
private

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

Referenced by getType().

◆ 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: