ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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.

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: shib_login.php:26

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

+ 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 202 of file class.ilLDAPRoleAssignmentRule.php.

202 : array
203 {
204 global $DIC;
205 $ilDB = $DIC->database();
206
207 $rules = [];
208
209 $query = "SELECT rule_id FROM ldap_role_assignments " .
210 "WHERE server_id = " . $ilDB->quote($a_server_id, 'integer');
211 $res = $ilDB->query($query);
212 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
213 $rules[] = self::_getInstanceByRuleId((int) $row->rule_id);
214 }
215
216 return $rules;
217 }
static _getInstanceByRuleId(int $a_rule_id)
$res
Definition: ltiservices.php:69

References $DIC, $ilDB, $res, _getInstanceByRuleId(), and ilDBConstants\FETCHMODE_OBJECT.

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ conditionToString()

ilLDAPRoleAssignmentRule::conditionToString ( )

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

389 : string
390 {
391 switch ($this->getType()) {
393 return $this->lng->txt('ldap_plugin_id') . ': ' . $this->getPluginId();
394
395 case self::TYPE_GROUP:
396 $dn_arr = explode(',', $this->getDN());
397 return $dn_arr[0];
398
400 return $this->getAttributeName() . '=' . $this->getAttributeValue();
401
402 default:
403 throw new RuntimeException(sprintf('Unknown type: %s', var_export($this->getType(), true)));
404 }
405 }

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

Referenced by ilLDAPSettingsGUI\confirmDeleteRules().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

ilLDAPRoleAssignmentRule::create ( )

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

407 : bool
408 {
409 $next_id = $this->db->nextId('ldap_role_assignments');
410
411 $query = "INSERT INTO ldap_role_assignments (server_id,rule_id,type,dn,attribute,isdn,att_name,att_value,role_id, " .
412 "add_on_update, remove_on_update, plugin_id ) " .
413 "VALUES( " .
414 $this->db->quote($this->getServerId(), 'integer') . ", " .
415 $this->db->quote($next_id, 'integer') . ", " .
416 $this->db->quote($this->getType(), 'integer') . ", " .
417 $this->db->quote($this->getDN(), 'text') . ", " .
418 $this->db->quote($this->getMemberAttribute(), 'text') . ", " .
419 $this->db->quote($this->isMemberAttributeDN(), 'integer') . ", " .
420 $this->db->quote($this->getAttributeName(), 'text') . ", " .
421 $this->db->quote($this->getAttributeValue(), 'text') . ", " .
422 $this->db->quote($this->getRoleId(), 'integer') . ", " .
423 $this->db->quote($this->isAddOnUpdateEnabled(), 'integer') . ', ' .
424 $this->db->quote($this->isRemoveOnUpdateEnabled(), 'integer') . ', ' .
425 $this->db->quote($this->getPluginId(), 'integer') . ' ' .
426 ")";
427 $this->db->manipulate($query);
428 $this->rule_id = $next_id;
429
430 return true;
431 }
isMemberAttributeDN()
is member attribute dn

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

+ Here is the call graph for this function:

◆ delete()

ilLDAPRoleAssignmentRule::delete ( )

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

490 : bool
491 {
492 $query = "DELETE FROM ldap_role_assignments " .
493 "WHERE rule_id = " . $this->db->quote($this->getRuleId(), 'integer') . " ";
494 $this->db->manipulate($query);
495
496 return true;
497 }

References getRuleId().

Referenced by ilLDAPSettingsGUI\deleteRulesCmd().

+ 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 354 of file class.ilLDAPRoleAssignmentRule.php.

354 : void
355 {
356 $this->add_on_update = $a_status;
357 }

Referenced by read().

+ Here is the caller graph for this function:

◆ enableRemoveOnUpdate()

ilLDAPRoleAssignmentRule::enableRemoveOnUpdate ( bool  $a_status)

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

364 : void
365 {
366 $this->remove_on_update = $a_status;
367 }

Referenced by read().

+ Here is the caller graph for this function:

◆ getAttributeName()

ilLDAPRoleAssignmentRule::getAttributeName ( )

get attribute name

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

333 : string
334 {
336 }

References $attribute_name.

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

+ Here is the caller graph for this function:

◆ getAttributeValue()

ilLDAPRoleAssignmentRule::getAttributeValue ( )

get atrtibute value

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

349 : string
350 {
352 }

References $attribute_value.

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

+ Here is the caller graph for this function:

◆ getDN()

ilLDAPRoleAssignmentRule::getDN ( )

get dn

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

288 : string
289 {
290 return $this->dn;
291 }

References $dn.

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

+ Here is the caller graph for this function:

◆ getMemberAttribute()

ilLDAPRoleAssignmentRule::getMemberAttribute ( )

get attribute

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

301 : string
302 {
304 }

References $member_attribute.

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

+ Here is the caller graph for this function:

◆ getPluginId()

ilLDAPRoleAssignmentRule::getPluginId ( )

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

379 : int
380 {
381 return $this->plugin_id;
382 }

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

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

232 : int
233 {
234 return $this->role_id;
235 }

References $role_id.

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

+ Here is the caller graph for this function:

◆ getRuleId()

ilLDAPRoleAssignmentRule::getRuleId ( )

get id

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

240 : int
241 {
242 return $this->rule_id;
243 }

References $rule_id.

Referenced by ilLDAPSettingsGUI\__construct(), delete(), read(), and update().

+ Here is the caller graph for this function:

◆ getServerId()

ilLDAPRoleAssignmentRule::getServerId ( )

get server id

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

256 : int
257 {
258 return $this->server_id;
259 }

References $server_id.

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

+ Here is the caller graph for this function:

◆ getType()

ilLDAPRoleAssignmentRule::getType ( )

getType

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

272 : int
273 {
274 return $this->type;
275 }

References $type.

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

+ 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.

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 }

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

Referenced by ilLDAPUserSynchronisation\isUpdateRequired().

+ Here is the caller graph for this function:

◆ isAddOnUpdateEnabled()

ilLDAPRoleAssignmentRule::isAddOnUpdateEnabled ( )

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

359 : bool
360 {
362 }

References $add_on_update.

Referenced by create(), and update().

+ 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 161 of file class.ilLDAPRoleAssignmentRule.php.

161 : bool
162 {
164
165 if ($this->isMemberAttributeDN()) {
166 if ($server->enabledEscapeDN()) {
167 $user_cmp = ldap_escape($a_user_data['dn'], "", LDAP_ESCAPE_FILTER);
168 } else {
169 $user_cmp = $a_user_data['dn'];
170 }
171 } else {
172 $user_cmp = $a_user_data['ilExternalAccount'];
173 }
174
175 try {
176 $query = new ilLDAPQuery($server);
177 $query->bind();
178 $res = $query->query(
179 $this->getDN(),
180 sprintf(
181 '(%s=%s)',
182 $this->getMemberAttribute(),
183 $user_cmp
184 ),
186 array('dn')
187 );
188 return (bool) $res->numRows();
189 } catch (ilLDAPQueryException $e) {
190 $this->logger->warning(': Caught Exception: ' . $e->getMessage());
191 return false;
192 }
193 }
static getInstanceByServerId(int $a_server_id)
Get instance by server id.
$server
Definition: shib_login.php:28

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

Referenced by matches().

+ 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 317 of file class.ilLDAPRoleAssignmentRule.php.

317 : bool
318 {
319 return $this->member_is_dn;
320 }

References $member_is_dn.

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

+ Here is the caller graph for this function:

◆ isPluginActive()

ilLDAPRoleAssignmentRule::isPluginActive ( )

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

384 : bool
385 {
386 return $this->getType() === self::TYPE_PLUGIN;
387 }

References getType(), and TYPE_PLUGIN.

+ Here is the call graph for this function:

◆ isRemoveOnUpdateEnabled()

ilLDAPRoleAssignmentRule::isRemoveOnUpdateEnabled ( )

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

369 : bool
370 {
372 }

References $remove_on_update.

Referenced by create(), and update().

+ 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.

90 : bool
91 {
92 switch ($this->getType()) {
94 return ilLDAPRoleAssignmentRules::callPlugin($this->getPluginId(), $a_user_data);
95
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 return false;
123 }
isGroupMember(array $a_user_data)
Check if user is member of specific group.
wildcardCompare(string $a_str1, string $a_str2)
static callPlugin(int $a_plugin_id, array $a_user_data)
Call plugin check if the condition matches.
static _lookupTitle(int $obj_id)

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

+ Here is the call graph for this function:

◆ read()

ilLDAPRoleAssignmentRule::read ( )
private

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

499 : void
500 {
501 $query = "SELECT * FROM ldap_role_assignments " .
502 "WHERE rule_id = " . $this->db->quote($this->getRuleId(), 'integer') . " ";
503
504 $res = $this->db->query($query);
505 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
506 $this->setServerId((int) $row->server_id);
507 $this->setType((int) $row->type);
508 if (!is_null($row->dn)) {
509 $this->setDN($row->dn);
510 }
511 if (!is_null($row->attribute)) {
512 $this->setMemberAttribute($row->attribute);
513 }
514 $this->setMemberIsDN((bool) $row->isdn);
515 if (!is_null($row->att_name)) {
516 $this->setAttributeName($row->att_name);
517 }
518 if (!is_null($row->att_value)) {
519 $this->setAttributeValue($row->att_value);
520 }
521 $this->setRoleId((int) $row->role_id);
522 if (!is_null($row->add_on_update)) {
523 $this->enableAddOnUpdate((bool) $row->add_on_update);
524 }
525 if (!is_null($row->remove_on_update)) {
526 $this->enableRemoveOnUpdate((bool) $row->remove_on_update);
527 }
528 if (!is_null($row->plugin_id)) {
529 $this->setPluginId((int) $row->plugin_id);
530 }
531 }
532 }
setAttributeName(string $a_name)
set attribute name
setMemberIsDN(bool $a_status)
set member attribute is dn
setAttributeValue(string $a_value)
set attribute value
setRoleId(int $a_role_id)
set role id

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

Referenced by __construct().

+ 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 325 of file class.ilLDAPRoleAssignmentRule.php.

325 : void
326 {
327 $this->attribute_name = $a_name;
328 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setAttributeValue()

ilLDAPRoleAssignmentRule::setAttributeValue ( string  $a_value)

set attribute value

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

341 : void
342 {
343 $this->attribute_value = $a_value;
344 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDN()

ilLDAPRoleAssignmentRule::setDN ( string  $a_dn)

set dn

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

280 : void
281 {
282 $this->dn = $a_dn;
283 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setMemberAttribute()

ilLDAPRoleAssignmentRule::setMemberAttribute ( string  $a_attribute)

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

293 : void
294 {
295 $this->member_attribute = $a_attribute;
296 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setMemberIsDN()

ilLDAPRoleAssignmentRule::setMemberIsDN ( bool  $a_status)

set member attribute is dn

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

309 : void
310 {
311 $this->member_is_dn = $a_status;
312 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setPluginId()

ilLDAPRoleAssignmentRule::setPluginId ( int  $a_id)

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

374 : void
375 {
376 $this->plugin_id = $a_id;
377 }

Referenced by read().

+ 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 224 of file class.ilLDAPRoleAssignmentRule.php.

224 : void
225 {
226 $this->role_id = $a_role_id;
227 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setServerId()

ilLDAPRoleAssignmentRule::setServerId ( int  $a_id)

set server id

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

248 : void
249 {
250 $this->server_id = $a_id;
251 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setType()

ilLDAPRoleAssignmentRule::setType ( int  $a_type)

set type

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

264 : void
265 {
266 $this->type = $a_type;
267 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilLDAPRoleAssignmentRule::update ( )

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

433 : bool
434 {
435 $query = "UPDATE ldap_role_assignments " .
436 "SET server_id = " . $this->db->quote($this->getServerId(), 'integer') . ", " .
437 "type = " . $this->db->quote($this->getType(), 'integer') . ", " .
438 "dn = " . $this->db->quote($this->getDN(), 'text') . ", " .
439 "attribute = " . $this->db->quote($this->getMemberAttribute(), 'text') . ", " .
440 "isdn = " . $this->db->quote($this->isMemberAttributeDN(), 'integer') . ", " .
441 "att_name = " . $this->db->quote($this->getAttributeName(), 'text') . ", " .
442 "att_value = " . $this->db->quote($this->getAttributeValue(), 'text') . ", " .
443 "role_id = " . $this->db->quote($this->getRoleId(), 'integer') . ", " .
444 "add_on_update = " . $this->db->quote($this->isAddOnUpdateEnabled(), 'integer') . ', ' .
445 'remove_on_update = ' . $this->db->quote($this->isRemoveOnUpdateEnabled(), 'integer') . ', ' .
446 'plugin_id = ' . $this->db->quote($this->getPluginId(), 'integer') . ' ' .
447 "WHERE rule_id = " . $this->db->quote($this->getRuleId(), 'integer') . " ";
448 $this->db->manipulate($query);
449
450 return true;
451 }

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

+ Here is the call graph for this function:

◆ validate()

ilLDAPRoleAssignmentRule::validate ( )

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

453 : bool
454 {
455 $this->ilErr->setMessage('');
456
457 if (!$this->getRoleId()) {
458 $this->ilErr->setMessage('fill_out_all_required_fields');
459 return false;
460 }
461 switch ($this->getType()) {
462 case self::TYPE_GROUP:
463 if ($this->getDN() === '' || $this->getMemberAttribute() === '') {
464 $this->ilErr->setMessage('fill_out_all_required_fields');
465 return false;
466 }
467 break;
469 if ($this->getAttributeName() === '' || $this->getAttributeValue() === '') {
470 $this->ilErr->setMessage('fill_out_all_required_fields');
471 return false;
472 }
473 break;
474
476 if (!$this->getPluginId()) {
477 $this->ilErr->setMessage('ldap_err_missing_plugin_id');
478 return false;
479 }
480 break;
481
482 default:
483 $this->ilErr->setMessage('ldap_no_type_given');
484 return false;
485 }
486
487 return true;
488 }

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

+ Here is the call graph for this function:

◆ wildcardCompare()

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

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

125 : bool
126 {
127 $pattern = str_replace('*', '.*?', $a_str1);
128
129 $exception = [];
130 foreach (ilAuthUtils::REGEX_DELIMITERS as $delimiter) {
131 $this->logger->debug('Trying pattern to match attribute value:' . $pattern . ' => ' . $a_str2);
132
133 set_error_handler(static function (int $severity, string $message, string $file, int $line): never {
134 throw new ErrorException($message, $severity, $severity, $file, $line);
135 });
136
137 $regex = $delimiter . "^" . $pattern . '$' . $delimiter . 'i';
138 try {
139 return preg_match($regex, $a_str2) === 1;
140 } catch (Exception $e) {
141 $exception[] = 'RegEx: ' . $regex . ' -> Message: ' . $e->getMessage();
142 } finally {
143 restore_error_handler();
144 }
145 }
146
147 if ($exception !== []) {
148 $this->logger->warning('Trying the RegEx delimiter chain results in the following problems: ' . implode(', ', $exception));
149 }
150
151 return false;
152 }
const array REGEX_DELIMITERS
$message
Definition: xapiexit.php:31

References Vendor\Package\$e, $message, ILIAS\Repository\logger(), and ilAuthUtils\REGEX_DELIMITERS.

Referenced by matches().

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