ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
AttributeRealm.php
Go to the documentation of this file.
1<?php
2
12
13 private $attributename = 'realm';
14
21 public function __construct($config, $reserved) {
22 parent::__construct($config, $reserved);
23 assert(is_array($config));
24
25 if (array_key_exists('attributename', $config))
26 $this->attributename = $config['attributename'];
27
28 }
29
37 public function process(&$request) {
38 assert(is_array($request));
39 assert(array_key_exists('Attributes', $request));
40
41 $attributes =& $request['Attributes'];
42
43 if (!array_key_exists('UserID', $request)) {
44 throw new Exception('core:AttributeRealm: Missing UserID for this user. Please' .
45 ' check the \'userid.attribute\' option in the metadata against the' .
46 ' attributes provided by the authentication source.');
47 }
48 $userID = $request['UserID'];
49 $decomposed = explode('@', $userID);
50 if (count($decomposed) !== 2) return;
51 $request['Attributes'][$this->attributename] = array($decomposed[1]);
52 }
53}
foreach($paths as $path) $request
Definition: asyncclient.php:32
An exception for terminatinating execution or to throw for unit testing.
process(&$request)
Apply filter to add or replace attributes.
__construct($config, $reserved)
Initialize this filter.
if(array_key_exists('yes', $_REQUEST)) $attributes
Definition: getconsent.php:85
$config
Definition: bootstrap.php:15