ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilLDAPRoleAssignmentRule Class Reference
+ Collaboration diagram for ilLDAPRoleAssignmentRule:

Public Member Functions

 _getRules ()
 Get all rules.
 setRoleId ($a_role_id)
 set role id
 getRoleId ()
 get role id
 getRuleId ()
 get id
 setServerId ($a_id)
 set server id
 getServerId ()
 get server id
 setType ($a_type)
 set type
 getType ()
 getType
 setDN ($a_dn)
 set dn
 getDN ()
 get dn
 setMemberAttribute ($a_attribute)
 public
 getMemberAttribute ()
 get attribute
 setMemberIsDN ($a_status)
 set member attribute is dn
 isMemberAttributeDN ()
 is member attribute dn
 setAttributeName ($a_name)
 set attribute name
 getAttributeName ()
 get attribute name
 setAttributeValue ($a_value)
 set attribute value
 getAttributeValue ()
 get atrtibute value
 conditionToString ()
 condition to string
 create ()
 create
 update ()
 update
 validate ()
 validate
 delete ()
 delete rule

Static Public Member Functions

static _getInstanceByRuleId ($a_rule_id)
 get instance by rule id

Data Fields

const TYPE_GROUP = 1
const TYPE_ATTRIBUTE = 2

Private Member Functions

 __construct ($a_id=0)
 Constructor.
 read ()
 load from db

Static Private Attributes

static $instances = null

Detailed Description

Author
Stefan Meyer smeye.nosp@m.r@da.nosp@m.tabay.nosp@m..de
Version
$Id$

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

Constructor & Destructor Documentation

ilLDAPRoleAssignmentRule::__construct (   $a_id = 0)
private

Constructor.

private

Parameters
intrule id

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

References read().

{
global $ilDB;
$this->db = $ilDB;
$this->rule_id = $a_id;
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

static ilLDAPRoleAssignmentRule::_getInstanceByRuleId (   $a_rule_id)
static

get instance by rule id

public

Parameters
intrule id

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

Referenced by _getRules(), ilLDAPSettingsGUI\addRoleAssignment(), ilLDAPSettingsGUI\confirmDeleteRules(), ilLDAPSettingsGUI\deleteRules(), ilLDAPSettingsGUI\editRoleAssignment(), ilLDAPSettingsGUI\roleAssignments(), and ilLDAPSettingsGUI\updateRoleAssignment().

{
if(isset(self::$instances[$a_rule_id]))
{
return self::$instances[$a_rule_id];
}
return self::$instances[$a_rule_id] = new ilLDAPRoleAssignmentRule($a_rule_id);
}

+ Here is the caller graph for this function:

ilLDAPRoleAssignmentRule::_getRules ( )

Get all rules.

public

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

References $res, _getInstanceByRuleId(), and DB_FETCHMODE_OBJECT.

Referenced by ilLDAPSettingsGUI\roleAssignments().

{
global $ilDB;
$query = "SELECT rule_id FROM ldap_role_assignments ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$rules[] = self::_getInstanceByRuleId($row->rule_id);
}
return $rules ? $rules : array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLDAPRoleAssignmentRule::conditionToString ( )

condition to string

public

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

References getAttributeName(), getAttributeValue(), getDN(), and getType().

{
switch($this->getType())
{
case self::TYPE_GROUP:
$dn_arr = explode(',',$this->getDN());
return $dn_arr[0];
case self::TYPE_ATTRIBUTE:
return $this->getAttributeName().'='.$this->getAttributeValue();
}
}

+ Here is the call graph for this function:

ilLDAPRoleAssignmentRule::create ( )

create

public

Parameters

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

References $res, getAttributeName(), getAttributeValue(), getDN(), getMemberAttribute(), getRoleId(), getServerId(), getType(), and isMemberAttributeDN().

{
$query = "INSERT INTO ldap_role_assignments ".
"SET server_id = ".$this->db->quote($this->getServerId()).", ".
"type = ".$this->db->quote($this->getType()).", ".
"dn = ".$this->db->quote($this->getDN()).", ".
"attribute = ".$this->db->quote($this->getMemberAttribute()).", ".
"isdn = ".$this->db->quote($this->isMemberAttributeDN()).", ".
"att_name = ".$this->db->quote($this->getAttributeName()).", ".
"att_value = ".$this->db->quote($this->getAttributeValue()).", ".
"role_id = ".(int) $this->getRoleId()." ";
$res = $this->db->query($query);
$this->rule_id = $this->db->getLastInsertId();
return true;
}

+ Here is the call graph for this function:

ilLDAPRoleAssignmentRule::delete ( )

delete rule

public

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

References getRuleId().

{
$query = "DELETE FROM ldap_role_assignments ".
"WHERE rule_id = ".$this->db->quote($this->getRuleId())." ";
$this->db->query($query);
return true;
}

+ Here is the call graph for this function:

ilLDAPRoleAssignmentRule::getAttributeName ( )

get attribute name

public

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

Referenced by conditionToString(), create(), ilLDAPSettingsGUI\initFormRoleAssignments(), update(), and validate().

{
return $this->attribute_name;
}

+ Here is the caller graph for this function:

ilLDAPRoleAssignmentRule::getAttributeValue ( )

get atrtibute value

public

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

Referenced by conditionToString(), create(), ilLDAPSettingsGUI\initFormRoleAssignments(), update(), and validate().

{
return $this->attribute_value;
}

+ Here is the caller graph for this function:

ilLDAPRoleAssignmentRule::getDN ( )

get dn

public

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

Referenced by conditionToString(), create(), ilLDAPSettingsGUI\initFormRoleAssignments(), update(), and validate().

{
return $this->dn;
}

+ Here is the caller graph for this function:

ilLDAPRoleAssignmentRule::getMemberAttribute ( )

get attribute

public

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

Referenced by create(), ilLDAPSettingsGUI\initFormRoleAssignments(), update(), and validate().

{
return $this->member_attribute;
}

+ Here is the caller graph for this function:

ilLDAPRoleAssignmentRule::getRoleId ( )

get role id

public

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

Referenced by create(), ilLDAPSettingsGUI\initFormRoleAssignments(), update(), and validate().

{
return $this->role_id;
}

+ Here is the caller graph for this function:

ilLDAPRoleAssignmentRule::getRuleId ( )

get id

public

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

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

{
return $this->rule_id;
}

+ Here is the caller graph for this function:

ilLDAPRoleAssignmentRule::getServerId ( )

get server id

public

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

Referenced by create(), and update().

{
return $this->server_id;
}

+ Here is the caller graph for this function:

ilLDAPRoleAssignmentRule::getType ( )

getType

public

Parameters

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

Referenced by conditionToString(), create(), ilLDAPSettingsGUI\initFormRoleAssignments(), update(), and validate().

{
return $this->type;
}

+ Here is the caller graph for this function:

ilLDAPRoleAssignmentRule::isMemberAttributeDN ( )

is member attribute dn

public

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

Referenced by create(), ilLDAPSettingsGUI\initFormRoleAssignments(), and update().

{
return (bool) $this->member_is_dn;
}

+ Here is the caller graph for this function:

ilLDAPRoleAssignmentRule::read ( )
private

load from db

private

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

References $res, DB_FETCHMODE_OBJECT, getRuleId(), setAttributeName(), setAttributeValue(), setDN(), setMemberAttribute(), setMemberIsDN(), setRoleId(), setServerId(), and setType().

Referenced by __construct().

{
$query = "SELECT * FROM ldap_role_assignments ".
"WHERE rule_id = ".$this->db->quote($this->getRuleId())." ";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->setServerId($row->server_id);
$this->setType($row->type);
$this->setDN($row->dn);
$this->setMemberAttribute($row->attribute);
$this->setMemberIsDN($row->isdn);
$this->setAttributeName($row->att_name);
$this->setAttributeValue($row->att_value);
$this->setRoleId($row->role_id);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLDAPRoleAssignmentRule::setAttributeName (   $a_name)

set attribute name

public

Parameters

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

Referenced by read().

{
$this->attribute_name = $a_name;
}

+ Here is the caller graph for this function:

ilLDAPRoleAssignmentRule::setAttributeValue (   $a_value)

set attribute value

public

Parameters
stringvalue

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

Referenced by read().

{
$this->attribute_value = $a_value;
}

+ Here is the caller graph for this function:

ilLDAPRoleAssignmentRule::setDN (   $a_dn)

set dn

public

Parameters
stringdn

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

Referenced by read().

{
$this->dn = $a_dn;
}

+ Here is the caller graph for this function:

ilLDAPRoleAssignmentRule::setMemberAttribute (   $a_attribute)

public

Parameters

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

Referenced by read().

{
$this->member_attribute = $a_attribute;
}

+ Here is the caller graph for this function:

ilLDAPRoleAssignmentRule::setMemberIsDN (   $a_status)

set member attribute is dn

public

Parameters
boolstatus

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

Referenced by read().

{
$this->member_is_dn = $a_status;
}

+ Here is the caller graph for this function:

ilLDAPRoleAssignmentRule::setRoleId (   $a_role_id)

set role id

public

Parameters
introle id of global role

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

Referenced by read().

{
$this->role_id = $a_role_id;
}

+ Here is the caller graph for this function:

ilLDAPRoleAssignmentRule::setServerId (   $a_id)

set server id

public

Parameters
intserver id

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

Referenced by read().

{
$this->server_id = $a_id;
}

+ Here is the caller graph for this function:

ilLDAPRoleAssignmentRule::setType (   $a_type)

set type

public

Parameters
inttype

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

Referenced by read().

{
$this->type = $a_type;
}

+ Here is the caller graph for this function:

ilLDAPRoleAssignmentRule::update ( )

update

public

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

References $res, getAttributeName(), getAttributeValue(), getDN(), getMemberAttribute(), getRoleId(), getRuleId(), getServerId(), getType(), and isMemberAttributeDN().

{
$query = "UPDATE ldap_role_assignments ".
"SET server_id = ".$this->db->quote($this->getServerId()).", ".
"type = ".$this->db->quote($this->getType()).", ".
"dn = ".$this->db->quote($this->getDN()).", ".
"attribute = ".$this->db->quote($this->getMemberAttribute()).", ".
"isdn = ".$this->db->quote($this->isMemberAttributeDN()).", ".
"att_name = ".$this->db->quote($this->getAttributeName()).", ".
"att_value = ".$this->db->quote($this->getAttributeValue()).", ".
"role_id = ".(int) $this->getRoleId()." ".
"WHERE rule_id = ".$this->db->quote($this->getRuleId())." ";
$res = $this->db->query($query);
$this->rule_id = $this->db->getLastInsertId();
return true;
}

+ Here is the call graph for this function:

ilLDAPRoleAssignmentRule::validate ( )

validate

public

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

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

{
global $ilErr;
$ilErr->setMessage('');
if(!$this->getRoleId())
{
$ilErr->setMessage('fill_out_all_required_fields');
return false;
}
switch($this->getType())
{
case self::TYPE_GROUP:
if(!strlen($this->getDN()) or !strlen($this->getMemberAttribute()))
{
$ilErr->setMessage('fill_out_all_required_fields');
return false;
}
break;
case self::TYPE_ATTRIBUTE:
if(!strlen($this->getAttributeName()) or !strlen($this->getAttributeValue()))
{
$ilErr->setMessage('fill_out_all_required_fields');
return false;
}
break;
default:
$ilErr->setMessage('ldap_no_type_given');
return false;
}
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilLDAPRoleAssignmentRule::$instances = null
staticprivate

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

const ilLDAPRoleAssignmentRule::TYPE_ATTRIBUTE = 2
const ilLDAPRoleAssignmentRule::TYPE_GROUP = 1

The documentation for this class was generated from the following file: