ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLDAPRoleAssignmentRule Class Reference
+ Collaboration diagram for ilLDAPRoleAssignmentRule:

Public Member Functions

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

Get all rules.

public

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

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

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

215  {
216  global $ilDB;
217 
218  $query = "SELECT rule_id FROM ldap_role_assignments ";
219  $res = $ilDB->query($query);
220  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
221  {
222  $rules[] = self::_getInstanceByRuleId($row->rule_id);
223  }
224  return $rules ? $rules : array();
225  }
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 465 of file class.ilLDAPRoleAssignmentRule.php.

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

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

◆ create()

ilLDAPRoleAssignmentRule::create ( )

create

public

Parameters

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

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

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

◆ delete()

ilLDAPRoleAssignmentRule::delete ( )

delete rule

public

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

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

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

◆ enableAddOnUpdate()

ilLDAPRoleAssignmentRule::enableAddOnUpdate (   $a_status)

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

Referenced by read().

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

◆ enableRemoveOnUpdate()

ilLDAPRoleAssignmentRule::enableRemoveOnUpdate (   $a_status)

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

Referenced by read().

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

◆ getAttributeName()

ilLDAPRoleAssignmentRule::getAttributeName ( )

get attribute name

public

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

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

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

◆ getAttributeValue()

ilLDAPRoleAssignmentRule::getAttributeValue ( )

get atrtibute value

public

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

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

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

◆ getDN()

ilLDAPRoleAssignmentRule::getDN ( )

get dn

public

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

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

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

◆ getMemberAttribute()

ilLDAPRoleAssignmentRule::getMemberAttribute ( )

get attribute

public

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

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

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

◆ getPluginId()

ilLDAPRoleAssignmentRule::getPluginId ( )

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

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

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

◆ getRuleId()

ilLDAPRoleAssignmentRule::getRuleId ( )

get id

public

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

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

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

◆ getServerId()

ilLDAPRoleAssignmentRule::getServerId ( )

get server id

public

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

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

304  {
305  return $this->type;
306  }
+ 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 428 of file class.ilLDAPRoleAssignmentRule.php.

References $add_on_update.

Referenced by create(), and update().

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

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

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

◆ isPluginActive()

ilLDAPRoleAssignmentRule::isPluginActive ( )

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

References getType().

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

◆ isRemoveOnUpdateEnabled()

ilLDAPRoleAssignmentRule::isRemoveOnUpdateEnabled ( )

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

References $remove_on_update.

Referenced by create(), and update().

439  {
440  return (bool) $this->remove_on_update;
441  }
+ 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 618 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().

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

Referenced by read().

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

◆ setAttributeValue()

ilLDAPRoleAssignmentRule::setAttributeValue (   $a_value)

set attribute value

public

Parameters
stringvalue

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

Referenced by read().

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

◆ setDN()

ilLDAPRoleAssignmentRule::setDN (   $a_dn)

set dn

public

Parameters
stringdn

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

Referenced by read().

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

◆ setMemberAttribute()

ilLDAPRoleAssignmentRule::setMemberAttribute (   $a_attribute)

public

Parameters

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

Referenced by read().

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

◆ setMemberIsDN()

ilLDAPRoleAssignmentRule::setMemberIsDN (   $a_status)

set member attribute is dn

public

Parameters
boolstatus

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

Referenced by read().

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

◆ setPluginId()

ilLDAPRoleAssignmentRule::setPluginId (   $a_id)

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

Referenced by read().

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

Referenced by read().

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

◆ setServerId()

ilLDAPRoleAssignmentRule::setServerId (   $a_id)

set server id

public

Parameters
intserver id

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

Referenced by read().

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

◆ setType()

ilLDAPRoleAssignmentRule::setType (   $a_type)

set type

public

Parameters
inttype

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

Referenced by read().

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

◆ update()

ilLDAPRoleAssignmentRule::update ( )

update

public

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

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

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

◆ validate()

ilLDAPRoleAssignmentRule::validate ( )

validate

public

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

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

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