ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilShibbolethRoleAssignmentRule Class Reference

Shibboleth role assignment rule. More...

+ Collaboration diagram for ilShibbolethRoleAssignmentRule:

Public Member Functions

 __construct ($a_rule_id=0)
 setRuleId ($a_id)
 getRuleId ()
 setRoleId ($a_id)
 getRoleId ()
 setName ($a_name)
 getName ()
 setValue ($a_value)
 getValue ()
 enablePlugin ($a_status)
 isPluginActive ()
 enableAddOnUpdate ($a_status)
 isAddOnUpdateEnabled ()
 enableRemoveOnUpdate ($a_status)
 isRemoveOnUpdateEnabled ()
 setPluginId ($a_id)
 getPluginId ()
 conditionToString ()
 validate ()
 delete ()
 add ()
 update ()
 matches ($a_data)

Data Fields

const ERR_MISSING_NAME = 'shib_missing_attr_name'
const ERR_MISSING_VALUE = 'shib_missing_attr_value'
const ERR_MISSING_ROLE = 'shib_missing_role'
const ERR_MISSING_PLUGIN_ID = 'shib_missing_plugin_id'

Protected Member Functions

 wildcardCompare ($a_str1, $a_str2)

Protected Attributes

 $db = null

Private Member Functions

 read ()

Private Attributes

 $rule_id = 0
 $role_id = 0
 $attribute_name = ''
 $attribute_value = ''
 $plugin_active = false
 $add_on_update = false
 $remove_on_update = false
 $plugin_id = 0

Detailed Description

Shibboleth role assignment rule.

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

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

Constructor & Destructor Documentation

ilShibbolethRoleAssignmentRule::__construct (   $a_rule_id = 0)

Definition at line 51 of file class.ilShibbolethRoleAssignmentRule.php.

References $ilDB, and read().

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

+ Here is the call graph for this function:

Member Function Documentation

ilShibbolethRoleAssignmentRule::add ( )

Definition at line 195 of file class.ilShibbolethRoleAssignmentRule.php.

References $ilDB, $query, getName(), getPluginId(), getRoleId(), getValue(), isAddOnUpdateEnabled(), isPluginActive(), isRemoveOnUpdateEnabled(), and setRuleId().

{
global $ilDB;
$next_id = $ilDB->nextId('shib_role_assignment');
$query = "INSERT INTO shib_role_assignment (rule_id,role_id,name,value,plugin,plugin_id,add_on_update,remove_on_update ) ".
"VALUES( ".
$ilDB->quote($next_id,'integer').', '.
$this->db->quote($this->getRoleId(),'integer').', '.
$this->db->quote($this->getName(),'text').', '.
$this->db->quote($this->getValue(),'text').', '.
$this->db->quote((int) $this->isPluginActive(),'integer').', '.
$this->db->quote((int) $this->getPluginId(),'integer').', '.
$this->db->quote((int) $this->isAddOnUpdateEnabled(),'integer').', '.
$this->db->quote((int) $this->isRemoveOnUpdateEnabled(),'integer').
') ';
$ilDB->manipulate($query);
$this->setRuleId($this->db->getLastInsertId());
return true;
}

+ Here is the call graph for this function:

ilShibbolethRoleAssignmentRule::conditionToString ( )

Definition at line 141 of file class.ilShibbolethRoleAssignmentRule.php.

References $lng, getName(), getPluginId(), getValue(), and isPluginActive().

{
global $lng;
if($this->isPluginActive())
{
return $lng->txt('shib_plugin_id').': '.$this->getPluginId();
}
else
{
return $this->getName().'='.$this->getValue();
}
}

+ Here is the call graph for this function:

ilShibbolethRoleAssignmentRule::delete ( )

Definition at line 185 of file class.ilShibbolethRoleAssignmentRule.php.

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

{
global $ilDB;;
$query = "DELETE FROM shib_role_assignment ".
"WHERE rule_id = ".$this->db->quote($this->getRuleId() , 'integer');
$ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

ilShibbolethRoleAssignmentRule::enableAddOnUpdate (   $a_status)

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

Referenced by read().

{
$this->add_on_update = $a_status;
}

+ Here is the caller graph for this function:

ilShibbolethRoleAssignmentRule::enablePlugin (   $a_status)

Definition at line 101 of file class.ilShibbolethRoleAssignmentRule.php.

Referenced by read().

{
$this->plugin_active = $a_status;
}

+ Here is the caller graph for this function:

ilShibbolethRoleAssignmentRule::enableRemoveOnUpdate (   $a_status)

Definition at line 121 of file class.ilShibbolethRoleAssignmentRule.php.

Referenced by read().

{
$this->remove_on_update = $a_status;
}

+ Here is the caller graph for this function:

ilShibbolethRoleAssignmentRule::getName ( )

Definition at line 86 of file class.ilShibbolethRoleAssignmentRule.php.

References $attribute_name.

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

{
}

+ Here is the caller graph for this function:

ilShibbolethRoleAssignmentRule::getPluginId ( )

Definition at line 136 of file class.ilShibbolethRoleAssignmentRule.php.

References $plugin_id.

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

{
}

+ Here is the caller graph for this function:

ilShibbolethRoleAssignmentRule::getRoleId ( )

Definition at line 76 of file class.ilShibbolethRoleAssignmentRule.php.

References $role_id.

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

{
}

+ Here is the caller graph for this function:

ilShibbolethRoleAssignmentRule::getRuleId ( )

Definition at line 66 of file class.ilShibbolethRoleAssignmentRule.php.

References $rule_id.

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

{
}

+ Here is the caller graph for this function:

ilShibbolethRoleAssignmentRule::getValue ( )

Definition at line 96 of file class.ilShibbolethRoleAssignmentRule.php.

References $attribute_value.

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

+ Here is the caller graph for this function:

ilShibbolethRoleAssignmentRule::isAddOnUpdateEnabled ( )

Definition at line 116 of file class.ilShibbolethRoleAssignmentRule.php.

References $add_on_update.

Referenced by add(), and update().

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

+ Here is the caller graph for this function:

ilShibbolethRoleAssignmentRule::isPluginActive ( )

Definition at line 106 of file class.ilShibbolethRoleAssignmentRule.php.

References $plugin_active.

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

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

+ Here is the caller graph for this function:

ilShibbolethRoleAssignmentRule::isRemoveOnUpdateEnabled ( )

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

References $remove_on_update.

Referenced by add(), and update().

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

+ Here is the caller graph for this function:

ilShibbolethRoleAssignmentRule::matches (   $a_data)

Definition at line 235 of file class.ilShibbolethRoleAssignmentRule.php.

References ilShibbolethRoleAssignmentRules\callPlugin(), getName(), getPluginId(), getValue(), isPluginActive(), and wildcardCompare().

{
if($this->isPluginActive())
{
include_once './Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRules.php';
}
// No value
if(!isset($a_data[$this->getName()]))
{
return false;
}
$values = $a_data[$this->getName()];
if(is_array($values))
{
return in_array($this->getValue(),$values);
}
else
{
return $this->wildcardCompare($this->getValue(),$values);
#return $this->getValue() == $values;
}
}

+ Here is the call graph for this function:

ilShibbolethRoleAssignmentRule::read ( )
private

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

References $query, $res, $row, DB_FETCHMODE_OBJECT, enableAddOnUpdate(), enablePlugin(), enableRemoveOnUpdate(), getRuleId(), setName(), setPluginId(), setRoleId(), and setValue().

Referenced by __construct().

{
if(!$this->getRuleId())
{
return true;
}
$query = "SELECT * FROM shib_role_assignment ".
"WHERE rule_id = ".$this->db->quote($this->getRuleId(),'integer');
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->setRoleId($row->role_id);
$this->setName($row->name);
$this->setValue($row->value);
$this->enablePlugin($row->plugin);
$this->setPluginId($row->plugin_id);
$this->enableAddOnUpdate($row->add_on_update);
$this->enableRemoveOnUpdate($row->remove_on_update);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilShibbolethRoleAssignmentRule::setName (   $a_name)

Definition at line 81 of file class.ilShibbolethRoleAssignmentRule.php.

Referenced by read().

{
$this->attribute_name = $a_name;
}

+ Here is the caller graph for this function:

ilShibbolethRoleAssignmentRule::setPluginId (   $a_id)

Definition at line 131 of file class.ilShibbolethRoleAssignmentRule.php.

Referenced by read().

{
$this->plugin_id = $a_id;
}

+ Here is the caller graph for this function:

ilShibbolethRoleAssignmentRule::setRoleId (   $a_id)

Definition at line 71 of file class.ilShibbolethRoleAssignmentRule.php.

Referenced by read().

{
$this->role_id = $a_id;
}

+ Here is the caller graph for this function:

ilShibbolethRoleAssignmentRule::setRuleId (   $a_id)

Definition at line 61 of file class.ilShibbolethRoleAssignmentRule.php.

Referenced by add().

{
$this->rule_id = $a_id;
}

+ Here is the caller graph for this function:

ilShibbolethRoleAssignmentRule::setValue (   $a_value)

Definition at line 91 of file class.ilShibbolethRoleAssignmentRule.php.

Referenced by read().

{
$this->attribute_value = $a_value;
}

+ Here is the caller graph for this function:

ilShibbolethRoleAssignmentRule::update ( )

Definition at line 217 of file class.ilShibbolethRoleAssignmentRule.php.

References $ilDB, $query, getName(), getPluginId(), getRoleId(), getRuleId(), getValue(), isAddOnUpdateEnabled(), isPluginActive(), and isRemoveOnUpdateEnabled().

{
global $ilDB;
$query = "UPDATE shib_role_assignment ".
"SET role_id = ".$this->db->quote($this->getRoleId(),'integer').', '.
"name = ".$this->db->quote($this->getName(),'text').', '.
"value = ".$this->db->quote($this->getValue(),'text').', '.
"plugin = ".$this->db->quote((int) $this->isPluginActive(),'integer').', '.
"plugin_id = ".$this->db->quote((int) $this->getPluginId(),'integer').', '.
"add_on_update = ".$this->db->quote((int) $this->isAddOnUpdateEnabled(),'integer').', '.
"remove_on_update = ".$this->db->quote((int) $this->isRemoveOnUpdateEnabled(),'integer').' '.
"WHERE rule_id = ".$this->db->quote($this->getRuleId(),'integer');
$ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

ilShibbolethRoleAssignmentRule::validate ( )

Definition at line 155 of file class.ilShibbolethRoleAssignmentRule.php.

References ERR_MISSING_NAME, ERR_MISSING_PLUGIN_ID, ERR_MISSING_ROLE, ERR_MISSING_VALUE, getName(), getPluginId(), getRoleId(), getValue(), and isPluginActive().

{
if(!$this->getRoleId())
{
}
if(!$this->isPluginActive())
{
if(!$this->getName())
{
}
if(!$this->getValue())
{
}
}
else
{
// check plugin id is given
if(!$this->getPluginId())
{
}
}
return '';
}

+ Here is the call graph for this function:

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

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

References $GLOBALS.

Referenced by matches().

{
$pattern = str_replace('*','.*?', $a_str1);
$GLOBALS['ilLog']->write(__METHOD__.': Replace pattern:'. $pattern.' => '.$a_str2);
return (bool) preg_match('/^'.$pattern.'$/i',$a_str2);
}

+ Here is the caller graph for this function:

Field Documentation

ilShibbolethRoleAssignmentRule::$add_on_update = false
private

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

Referenced by isAddOnUpdateEnabled().

ilShibbolethRoleAssignmentRule::$attribute_name = ''
private

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

Referenced by getName().

ilShibbolethRoleAssignmentRule::$attribute_value = ''
private

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

Referenced by getValue().

ilShibbolethRoleAssignmentRule::$db = null
protected

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

ilShibbolethRoleAssignmentRule::$plugin_active = false
private

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

Referenced by isPluginActive().

ilShibbolethRoleAssignmentRule::$plugin_id = 0
private

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

Referenced by getPluginId().

ilShibbolethRoleAssignmentRule::$remove_on_update = false
private

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

Referenced by isRemoveOnUpdateEnabled().

ilShibbolethRoleAssignmentRule::$role_id = 0
private

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

Referenced by getRoleId().

ilShibbolethRoleAssignmentRule::$rule_id = 0
private

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

Referenced by getRuleId().

const ilShibbolethRoleAssignmentRule::ERR_MISSING_NAME = 'shib_missing_attr_name'

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

Referenced by validate().

const ilShibbolethRoleAssignmentRule::ERR_MISSING_PLUGIN_ID = 'shib_missing_plugin_id'

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

Referenced by validate().

const ilShibbolethRoleAssignmentRule::ERR_MISSING_ROLE = 'shib_missing_role'

Definition at line 37 of file class.ilShibbolethRoleAssignmentRule.php.

Referenced by validate().

const ilShibbolethRoleAssignmentRule::ERR_MISSING_VALUE = 'shib_missing_attr_value'

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

Referenced by validate().


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