ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
sspmod_core_Auth_Process_AttributeAdd Class Reference
+ Inheritance diagram for sspmod_core_Auth_Process_AttributeAdd:
+ Collaboration diagram for sspmod_core_Auth_Process_AttributeAdd:

Public Member Functions

 __construct ($config, $reserved)
 Initialize this filter. More...
 
 process (&$request)
 Apply filter to add or replace attributes. More...
 
- Public Member Functions inherited from SimpleSAML_Auth_ProcessingFilter
 __construct (&$config, $reserved)
 Constructor for a processing filter. More...
 
 process (&$request)
 Process a request. More...
 

Private Attributes

 $replace = FALSE
 Flag which indicates wheter this filter should append new values or replace old values. More...
 
 $attributes = array()
 Attributes which should be added/appended. More...
 

Additional Inherited Members

- Data Fields inherited from SimpleSAML_Auth_ProcessingFilter
 $priority = 50
 Priority of this filter. More...
 

Detailed Description

Definition at line 11 of file AttributeAdd.php.

Constructor & Destructor Documentation

◆ __construct()

sspmod_core_Auth_Process_AttributeAdd::__construct (   $config,
  $reserved 
)

Initialize this filter.

Parameters
array$configConfiguration information about this filter.
mixed$reservedFor future use.

Definition at line 33 of file AttributeAdd.php.

References $config, $name, and $values.

33  {
34  parent::__construct($config, $reserved);
35 
36  assert(is_array($config));
37 
38  foreach($config as $name => $values) {
39  if(is_int($name)) {
40  if($values === '%replace') {
41  $this->replace = TRUE;
42  } else {
43  throw new Exception('Unknown flag: ' . var_export($values, TRUE));
44  }
45  continue;
46  }
47 
48  if(!is_array($values)) {
49  $values = array($values);
50  }
51  foreach($values as $value) {
52  if(!is_string($value)) {
53  throw new Exception('Invalid value for attribute ' . $name . ': ' .
54  var_export($values, TRUE));
55  }
56  }
57 
58  $this->attributes[$name] = $values;
59  }
60  }
$config
Definition: bootstrap.php:15
$values

Member Function Documentation

◆ process()

sspmod_core_Auth_Process_AttributeAdd::process ( $request)

Apply filter to add or replace attributes.

Add or replace existing attributes with the configured values.

Parameters
array&$requestThe current request

Definition at line 70 of file AttributeAdd.php.

References $attributes, $name, $request, and $values.

70  {
71  assert(is_array($request));
72  assert(array_key_exists('Attributes', $request));
73 
74  $attributes =& $request['Attributes'];
75 
76  foreach($this->attributes as $name => $values) {
77  if($this->replace === TRUE || !array_key_exists($name, $attributes)) {
79  } else {
80  $attributes[$name] = array_merge($attributes[$name], $values);
81  }
82  }
83  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
$values
$attributes
Attributes which should be added/appended.

Field Documentation

◆ $attributes

sspmod_core_Auth_Process_AttributeAdd::$attributes = array()
private

Attributes which should be added/appended.

Assiciative array of arrays.

Definition at line 24 of file AttributeAdd.php.

Referenced by process().

◆ $replace

sspmod_core_Auth_Process_AttributeAdd::$replace = FALSE
private

Flag which indicates wheter this filter should append new values or replace old values.

Definition at line 16 of file AttributeAdd.php.


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