ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
ilLDAPRoleAssignmentRule Class Reference
+ Collaboration diagram for ilLDAPRoleAssignmentRule:

Public Member Functions

 matches ($a_user_data)
 Check if a rule matches. More...
 
 _getRules ($a_server_id)
 Get all rules. 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...
 

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

 $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

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilLDAPRoleAssignmentRule::__construct (   $a_id = 0)
private

Constructor.

private

Parameters
intrule id

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

References $ilDB, and read().

55  {
56  global $ilDB;
57 
58  $this->db = $ilDB;
59 
60  $this->rule_id = $a_id;
61  $this->read();
62  }
global $ilDB
+ 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 72 of file class.ilLDAPRoleAssignmentRule.php.

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

73  {
74  if(isset(self::$instances[$a_rule_id]))
75  {
76  return self::$instances[$a_rule_id];
77  }
78  return self::$instances[$a_rule_id] = new ilLDAPRoleAssignmentRule($a_rule_id);
79  }
+ Here is the caller graph for this function:

◆ _getRules()

ilLDAPRoleAssignmentRule::_getRules (   $a_server_id)

Get all rules.

public

Returns
ilLDAPRoleAssignmentRule

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

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

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

215  {
216  global $ilDB;
217 
218  $query = "SELECT rule_id FROM ldap_role_assignments ".
219  "WHERE server_id = ".$ilDB->quote($a_server_id,'integer');
220  $res = $ilDB->query($query);
221  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
222  {
223  $rules[] = self::_getInstanceByRuleId($row->rule_id);
224  }
225  return $rules ? $rules : array();
226  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB
+ Here is the caller graph for this function:

◆ conditionToString()

ilLDAPRoleAssignmentRule::conditionToString ( )

condition to string

public

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

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

467  {
468  global $lng;
469 
470  switch($this->getType())
471  {
472  case self::TYPE_PLUGIN:
473  return $lng->txt('ldap_plugin_id').': '.$this->getPluginId();
474 
475  case self::TYPE_GROUP:
476  $dn_arr = explode(',',$this->getDN());
477  return $dn_arr[0];
478 
479 
480  case self::TYPE_ATTRIBUTE:
481  return $this->getAttributeName().'='.$this->getAttributeValue();
482  }
483  }
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ create()

ilLDAPRoleAssignmentRule::create ( )

create

public

Parameters

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

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

494  {
495  global $ilDB;
496 
497  $next_id = $ilDB->nextId('ldap_role_assignments');
498 
499  $query = "INSERT INTO ldap_role_assignments (server_id,rule_id,type,dn,attribute,isdn,att_name,att_value,role_id, ".
500  "add_on_update, remove_on_update, plugin_id ) ".
501  "VALUES( ".
502  $this->db->quote($this->getServerId(),'integer').", ".
503  $this->db->quote($next_id,'integer').", ".
504  $this->db->quote($this->getType(),'integer').", ".
505  $this->db->quote($this->getDN(),'text').", ".
506  $this->db->quote($this->getMemberAttribute(),'text').", ".
507  $this->db->quote($this->isMemberAttributeDN(),'integer').", ".
508  $this->db->quote($this->getAttributeName(),'text').", ".
509  $this->db->quote($this->getAttributeValue(),'text').", ".
510  $this->db->quote($this->getRoleId(),'integer').", ".
511  $this->db->quote($this->isAddOnUpdateEnabled(), 'integer').', '.
512  $this->db->quote($this->isRemoveOnUpdateEnabled(), 'integer').', '.
513  $this->db->quote($this->getPluginId(),'integer').' '.
514  ")";
515  $res = $ilDB->manipulate($query);
516  $this->rule_id = $next_id;
517 
518  return true;
519  }
isMemberAttributeDN()
is member attribute dn
global $ilDB
+ Here is the call graph for this function:

◆ delete()

ilLDAPRoleAssignmentRule::delete ( )

delete rule

public

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

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

604  {
605  global $ilDB;
606 
607  $query = "DELETE FROM ldap_role_assignments ".
608  "WHERE rule_id = ".$this->db->quote($this->getRuleId(),'integer')." ";
609  $res = $ilDB->manipulate($query);
610  return true;
611 
612  }
global $ilDB
+ Here is the call graph for this function:

◆ enableAddOnUpdate()

ilLDAPRoleAssignmentRule::enableAddOnUpdate (   $a_status)

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

Referenced by read().

425  {
426  $this->add_on_update = $a_status;
427  }
+ Here is the caller graph for this function:

◆ enableRemoveOnUpdate()

ilLDAPRoleAssignmentRule::enableRemoveOnUpdate (   $a_status)

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

Referenced by read().

435  {
436  $this->remove_on_update = $a_status;
437  }
+ Here is the caller graph for this function:

◆ getAttributeName()

ilLDAPRoleAssignmentRule::getAttributeName ( )

get attribute name

public

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

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

397  {
398  return $this->attribute_name;
399  }
+ Here is the caller graph for this function:

◆ getAttributeValue()

ilLDAPRoleAssignmentRule::getAttributeValue ( )

get atrtibute value

public

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

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

420  {
421  return $this->attribute_value;
422  }
+ Here is the caller graph for this function:

◆ getDN()

ilLDAPRoleAssignmentRule::getDN ( )

get dn

public

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

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

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

◆ getMemberAttribute()

ilLDAPRoleAssignmentRule::getMemberAttribute ( )

get attribute

public

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

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

351  {
352  return $this->member_attribute;
353  }
+ Here is the caller graph for this function:

◆ getPluginId()

ilLDAPRoleAssignmentRule::getPluginId ( )

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

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

247  {
248  return $this->role_id;
249  }
+ Here is the caller graph for this function:

◆ getRuleId()

ilLDAPRoleAssignmentRule::getRuleId ( )

get id

public

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

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

258  {
259  return $this->rule_id;
260  }
+ Here is the caller graph for this function:

◆ getServerId()

ilLDAPRoleAssignmentRule::getServerId ( )

get server id

public

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

References $server_id.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getType()

ilLDAPRoleAssignmentRule::getType ( )

getType

public

Parameters

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

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

305  {
306  return $this->type;
307  }
+ Here is the caller graph for this function:

◆ hasRulesForUpdate()

static ilLDAPRoleAssignmentRule::hasRulesForUpdate ( )
static

Check if there any rule for updates.

Returns

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

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

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

86  {
87  global $ilDB;
88 
89  $query = 'SELECT COUNT(*) num FROM ldap_role_assignments '.
90  'WHERE add_on_update = 1 '.
91  'OR remove_on_update = 1 ';
92  $res = $ilDB->query($query);
93  $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
94  return $row->num > 0;
95  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB
+ Here is the caller graph for this function:

◆ isAddOnUpdateEnabled()

ilLDAPRoleAssignmentRule::isAddOnUpdateEnabled ( )

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

References $add_on_update.

Referenced by create(), and update().

430  {
431  return (bool) $this->add_on_update;
432  }
+ 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 168 of file class.ilLDAPRoleAssignmentRule.php.

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

Referenced by matches().

169  {
170  global $ilLog;
171 
172 
173  if($this->isMemberAttributeDN())
174  {
175  $user_cmp = $a_user_data['dn'];
176  }
177  else
178  {
179  $user_cmp = $a_user_data['ilExternalAccount'];
180  }
181 
182  include_once('Services/LDAP/classes/class.ilLDAPQuery.php');
183  include_once('Services/LDAP/classes/class.ilLDAPServer.php');
184 
186 
187  try
188  {
189  $query = new ilLDAPQuery($server);
190  $query->bind();
191  $res = $query->query($this->getDN(),
192  sprintf('(%s=%s)',
193  $this->getMemberAttribute(),
194  $user_cmp),
196  array('dn'));
197  return $res->numRows() ? true : false;
198  }
199  catch(ilLDAPQueryException $e)
200  {
201  $ilLog->write(__METHOD__.': Caught Exception: '.$e->getMessage());
202  return false;
203  }
204  }
static _getFirstActiveServer()
Get first active server.
isMemberAttributeDN()
is member attribute dn
static getInstanceByServerId($a_server_id)
Get instance by server id.
$server
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 373 of file class.ilLDAPRoleAssignmentRule.php.

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

374  {
375  return (bool) $this->member_is_dn;
376  }
+ Here is the caller graph for this function:

◆ isPluginActive()

ilLDAPRoleAssignmentRule::isPluginActive ( )

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

References getType().

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

◆ isRemoveOnUpdateEnabled()

ilLDAPRoleAssignmentRule::isRemoveOnUpdateEnabled ( )

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

References $remove_on_update.

Referenced by create(), and update().

440  {
441  return (bool) $this->remove_on_update;
442  }
+ 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 102 of file class.ilLDAPRoleAssignmentRule.php.

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

103  {
104  global $ilLog;
105 
106  switch($this->getType())
107  {
108  case self::TYPE_PLUGIN:
109  include_once './Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php';
110  return ilLDAPRoleAssignmentRules::callPlugin($this->getPluginId(), $a_user_data);
111 
112  case self::TYPE_ATTRIBUTE:
113 
114  $attn = strtolower($this->getAttributeName());
115 
116  if(!isset($a_user_data[$attn]))
117  {
118  return false;
119  }
120 
121  if(!is_array($a_user_data[$attn]))
122  {
123  $attribute_val = array(0 => $a_user_data[$attn]);
124  }
125  else
126  {
127  $attribute_val = $a_user_data[$attn];
128  }
129 
130  foreach($attribute_val as $value)
131  {
132  if($this->wildcardCompare(trim($this->getAttributeValue()),trim($value)))
133  {
134  $ilLog->write(__METHOD__.': Found role mapping: '.ilObject::_lookupTitle($this->getRoleId()));
135  return true;
136  }
137  /*
138  if(trim($value) == trim($this->getAttributeValue()))
139  {
140  $ilLog->write(__METHOD__.': Found role mapping: '.ilObject::_lookupTitle($this->getRoleId()));
141  return true;
142  }
143  */
144  }
145  return false;
146 
147  case self::TYPE_GROUP:
148  return $this->isGroupMember($a_user_data);
149 
150  }
151  }
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 619 of file class.ilLDAPRoleAssignmentRule.php.

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

Referenced by __construct().

620  {
621  global $ilDB;
622 
623  $query = "SELECT * FROM ldap_role_assignments ".
624  "WHERE rule_id = ".$this->db->quote($this->getRuleId(),'integer')." ";
625 
626  $res = $this->db->query($query);
627  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
628  {
629  $this->setServerId($row->server_id);
630  $this->setType($row->type);
631  $this->setDN($row->dn);
632  $this->setMemberAttribute($row->attribute);
633  $this->setMemberIsDN($row->isdn);
634  $this->setAttributeName($row->att_name);
635  $this->setAttributeValue($row->att_value);
636  $this->setRoleId($row->role_id);
637  $this->enableAddOnUpdate($row->add_on_update);
638  $this->enableRemoveOnUpdate($row->remove_on_update);
639  $this->setPluginId($row->plugin_id);
640  }
641  }
setAttributeName($a_name)
set attribute name
setAttributeValue($a_value)
set attribute value
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
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 385 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by read().

386  {
387  $this->attribute_name = $a_name;
388  }
+ Here is the caller graph for this function:

◆ setAttributeValue()

ilLDAPRoleAssignmentRule::setAttributeValue (   $a_value)

set attribute value

public

Parameters
stringvalue

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

Referenced by read().

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

◆ setDN()

ilLDAPRoleAssignmentRule::setDN (   $a_dn)

set dn

public

Parameters
stringdn

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

Referenced by read().

317  {
318  $this->dn = $a_dn;
319  }
+ Here is the caller graph for this function:

◆ setMemberAttribute()

ilLDAPRoleAssignmentRule::setMemberAttribute (   $a_attribute)

public

Parameters

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

Referenced by read().

340  {
341  $this->member_attribute = $a_attribute;
342  }
+ Here is the caller graph for this function:

◆ setMemberIsDN()

ilLDAPRoleAssignmentRule::setMemberIsDN (   $a_status)

set member attribute is dn

public

Parameters
boolstatus

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

Referenced by read().

363  {
364  $this->member_is_dn = $a_status;
365  }
+ Here is the caller graph for this function:

◆ setPluginId()

ilLDAPRoleAssignmentRule::setPluginId (   $a_id)

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

Referenced by read().

445  {
446  $this->plugin_id = $a_id;
447  }
+ 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 235 of file class.ilLDAPRoleAssignmentRule.php.

Referenced by read().

236  {
237  $this->role_id = $a_role_id;
238  }
+ Here is the caller graph for this function:

◆ setServerId()

ilLDAPRoleAssignmentRule::setServerId (   $a_id)

set server id

public

Parameters
intserver id

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

Referenced by read().

270  {
271  $this->server_id = $a_id;
272  }
+ Here is the caller graph for this function:

◆ setType()

ilLDAPRoleAssignmentRule::setType (   $a_type)

set type

public

Parameters
inttype

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

Referenced by read().

293  {
294  $this->type = $a_type;
295  }
+ Here is the caller graph for this function:

◆ update()

ilLDAPRoleAssignmentRule::update ( )

update

public

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

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

528  {
529  global $ilDB;
530 
531  $query = "UPDATE ldap_role_assignments ".
532  "SET server_id = ".$this->db->quote($this->getServerId(),'integer').", ".
533  "type = ".$this->db->quote($this->getType(),'integer').", ".
534  "dn = ".$this->db->quote($this->getDN(),'text').", ".
535  "attribute = ".$this->db->quote($this->getMemberAttribute(),'text').", ".
536  "isdn = ".$this->db->quote($this->isMemberAttributeDN(),'integer').", ".
537  "att_name = ".$this->db->quote($this->getAttributeName(),'text').", ".
538  "att_value = ".$this->db->quote($this->getAttributeValue(),'text').", ".
539  "role_id = ".$this->db->quote($this->getRoleId(),'integer').", ".
540  "add_on_update = ".$this->db->quote($this->isAddOnUpdateEnabled(),'integer').', '.
541  'remove_on_update = '.$this->db->quote($this->isRemoveOnUpdateEnabled(),'integer').', '.
542  'plugin_id = '.$this->db->quote($this->getPluginId(),'integer').' '.
543  "WHERE rule_id = ".$this->db->quote($this->getRuleId(),'integer')." ";
544  $res = $ilDB->manipulate($query);
545  return true;
546  }
isMemberAttributeDN()
is member attribute dn
global $ilDB
+ Here is the call graph for this function:

◆ validate()

ilLDAPRoleAssignmentRule::validate ( )

validate

public

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

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

555  {
556  global $ilErr;
557 
558  $ilErr->setMessage('');
559 
560  if(!$this->getRoleId())
561  {
562  $ilErr->setMessage('fill_out_all_required_fields');
563  return false;
564  }
565  switch($this->getType())
566  {
567  case self::TYPE_GROUP:
568  if(!strlen($this->getDN()) or !strlen($this->getMemberAttribute()))
569  {
570  $ilErr->setMessage('fill_out_all_required_fields');
571  return false;
572  }
573  break;
574  case self::TYPE_ATTRIBUTE:
575  if(!strlen($this->getAttributeName()) or !strlen($this->getAttributeValue()))
576  {
577  $ilErr->setMessage('fill_out_all_required_fields');
578  return false;
579  }
580  break;
581 
582  case self::TYPE_PLUGIN:
583  if(!$this->getPluginId())
584  {
585  $ilErr->setMessage('ldap_err_missing_plugin_id');
586  return false;
587  }
588  break;
589 
590  default:
591  $ilErr->setMessage('ldap_no_type_given');
592  return false;
593  }
594  return true;
595  }
+ Here is the call graph for this function:

◆ wildcardCompare()

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

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

References $GLOBALS.

Referenced by matches().

154  {
155  $pattern = str_replace('*','.*?', $a_str1);
156  $GLOBALS['ilLog']->write(__METHOD__.': Replace pattern:'. $pattern.' => '.$a_str2);
157  return (bool) preg_match('/^'.$pattern.'$/i',$a_str2);
158  }
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
+ Here is the caller graph for this function:

Field Documentation

◆ $add_on_update

ilLDAPRoleAssignmentRule::$add_on_update = false
private

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

Referenced by isAddOnUpdateEnabled().

◆ $instances

ilLDAPRoleAssignmentRule::$instances = null
staticprivate

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

◆ $plugin_active

ilLDAPRoleAssignmentRule::$plugin_active = false
private

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

◆ $plugin_id

ilLDAPRoleAssignmentRule::$plugin_id = 0
private

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

Referenced by getPluginId().

◆ $remove_on_update

ilLDAPRoleAssignmentRule::$remove_on_update = false
private

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

Referenced by isRemoveOnUpdateEnabled().

◆ $server_id

ilLDAPRoleAssignmentRule::$server_id = 0
private

Definition at line 40 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: