ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
sspmod_core_Auth_Process_ScopeAttribute Class Reference
+ Inheritance diagram for sspmod_core_Auth_Process_ScopeAttribute:
+ Collaboration diagram for sspmod_core_Auth_Process_ScopeAttribute:

Public Member Functions

 __construct ($config, $reserved)
 Initialize this filter, parse configuration. More...
 
 process (&$request)
 Apply this filter to the request. 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

 $scopeAttribute
 
 $sourceAttribute
 
 $targetAttribute
 
 $onlyIfEmpty = false
 

Additional Inherited Members

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

Detailed Description

Definition at line 8 of file ScopeAttribute.php.

Constructor & Destructor Documentation

◆ __construct()

sspmod_core_Auth_Process_ScopeAttribute::__construct (   $config,
  $reserved 
)

Initialize this filter, parse configuration.

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

Definition at line 47 of file ScopeAttribute.php.

References $config, and SimpleSAML_Configuration\loadFromArray().

47  {
48  parent::__construct($config, $reserved);
49  assert('is_array($config)');
50 
52 
53  $this->scopeAttribute = $config->getString('scopeAttribute');
54  $this->sourceAttribute = $config->getString('sourceAttribute');
55  $this->targetAttribute = $config->getString('targetAttribute');
56  $this->onlyIfEmpty = $config->getBoolean('onlyIfEmpty', false);
57  }
static loadFromArray($config, $location='[ARRAY]', $instance=null)
Loads a configuration from the given array.
+ Here is the call graph for this function:

Member Function Documentation

◆ process()

sspmod_core_Auth_Process_ScopeAttribute::process ( $request)

Apply this filter to the request.

Parameters
array&$requestThe current request

Definition at line 65 of file ScopeAttribute.php.

References $attributes, $targetAttribute, and array.

65  {
66  assert('is_array($request)');
67  assert('array_key_exists("Attributes", $request)');
68 
69  $attributes =& $request['Attributes'];
70 
71  if (!isset($attributes[$this->scopeAttribute])) {
72  return;
73  }
74 
75  if (!isset($attributes[$this->sourceAttribute])) {
76  return;
77  }
78 
79  if (!isset($attributes[$this->targetAttribute])) {
81  }
82 
83  if ($this->onlyIfEmpty and count($attributes[$this->targetAttribute]) > 0) {
84  return;
85  }
86 
87  foreach ($attributes[$this->scopeAttribute] as $scope) {
88 
89  if (strpos($scope, '@') !== FALSE) {
90  $scope = explode('@', $scope, 2);
91  $scope = $scope[1];
92  }
93 
94  foreach ($attributes[$this->sourceAttribute] as $value) {
95  $value = $value . '@' . $scope;
96 
97  if (in_array($value, $attributes[$this->targetAttribute], TRUE)) {
98  // Already present
99  continue;
100  }
101 
103  }
104  }
105 
106  }
$attributes
Create styles array
The data for the language used.

Field Documentation

◆ $onlyIfEmpty

sspmod_core_Auth_Process_ScopeAttribute::$onlyIfEmpty = false
private

Definition at line 38 of file ScopeAttribute.php.

◆ $scopeAttribute

sspmod_core_Auth_Process_ScopeAttribute::$scopeAttribute
private

Definition at line 15 of file ScopeAttribute.php.

◆ $sourceAttribute

sspmod_core_Auth_Process_ScopeAttribute::$sourceAttribute
private

Definition at line 23 of file ScopeAttribute.php.

◆ $targetAttribute

sspmod_core_Auth_Process_ScopeAttribute::$targetAttribute
private

Definition at line 31 of file ScopeAttribute.php.

Referenced by process().


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