|
| __construct ($acl) |
| Initializer for this access control list. More...
|
|
| allows (array $attributes) |
| Match the attributes against the access control list. More...
|
|
|
static | getById ($id) |
| Retrieve an access control list with the given id. More...
|
|
static | match (array $attributes, array $rule) |
| Match the attributes against the given rule. More...
|
|
static | opAnd ($attributes, $rule) |
| 'and' match operator. More...
|
|
static | opEquals ($attributes, $rule) |
| 'equals' match operator. More...
|
|
static | opEqualsPreg ($attributes, $rule) |
| 'equals-preg' match operator. More...
|
|
static | opHas ($attributes, $rule) |
| 'has' match operator. More...
|
|
static | opHasPreg ($attributes, $rule) |
| 'has-preg' match operator. More...
|
|
static | opOr ($attributes, $rule) |
| 'or' match operator. More...
|
|
Definition at line 8 of file ACL.php.
◆ __construct()
sspmod_core_ACL::__construct |
( |
|
$acl | ) |
|
Initializer for this access control list.
- Parameters
-
array | string | $acl | The access control list. |
Definition at line 23 of file ACL.php.
23 {
24 assert('is_string($acl) || is_array($acl)');
25
26 if (is_string(
$acl)) {
28 }
29
31 if (!is_array(
$rule)) {
33 }
34 if (count(
$rule) === 0) {
36 }
37
41 }
42
43 }
44
46 }
static getById($id)
Retrieve an access control list with the given id.
References $acl, $action, $rule, and getById().
◆ allows()
sspmod_core_ACL::allows |
( |
array |
$attributes | ) |
|
Match the attributes against the access control list.
- Parameters
-
array | $attributes | The attributes of an user. |
- Returns
- boolean TRUE if the user is allowed to access the resource, FALSE if not.
Definition at line 73 of file ACL.php.
73 {
74
75 foreach ($this->acl as
$rule) {
77
79 continue;
80 }
81
83 return TRUE;
84 } else {
85 return FALSE;
86 }
87 }
88 }
References $action, $attributes, and $rule.
◆ getById()
static sspmod_core_ACL::getById |
( |
|
$id | ) |
|
|
staticprivate |
Retrieve an access control list with the given id.
- Parameters
-
string | $id | The id of the access control list. |
- Returns
- array The access control list array.
Definition at line 55 of file ACL.php.
55 {
56 assert('is_string($id)');
57
61 }
62
64 }
static getOptionalConfig($filename='config.php', $configSet='simplesaml')
Load a configuration file from a configuration set.
if(!array_key_exists('StateId', $_REQUEST)) $id
References $config, $id, and SimpleSAML_Configuration\getOptionalConfig().
Referenced by __construct().
◆ match()
static sspmod_core_ACL::match |
( |
array |
$attributes, |
|
|
array |
$rule |
|
) |
| |
|
staticprivate |
Match the attributes against the given rule.
- Parameters
-
array | $attributes | The attributes of an user. |
array | $rule | The rule we should check. |
- Returns
- boolean TRUE if the rule matches, FALSE if not.
Definition at line 98 of file ACL.php.
98 {
99
100 $op = array_shift(
$rule);
101 if ($op === NULL) {
102
103 return TRUE;
104 }
105
106 switch($op) {
107 case 'and':
109 case 'equals':
111 case 'equals-preg':
113 case 'has':
115 case 'has-preg':
117 case 'not':
119 case 'or':
121 default:
123 }
124 }
static opEqualsPreg($attributes, $rule)
'equals-preg' match operator.
static opHas($attributes, $rule)
'has' match operator.
static match(array $attributes, array $rule)
Match the attributes against the given rule.
static opEquals($attributes, $rule)
'equals' match operator.
static opAnd($attributes, $rule)
'and' match operator.
static opHasPreg($attributes, $rule)
'has-preg' match operator.
static opOr($attributes, $rule)
'or' match operator.
References $attributes, $rule, match(), opAnd(), opEquals(), opEqualsPreg(), opHas(), opHasPreg(), and opOr().
Referenced by match().
◆ opAnd()
static sspmod_core_ACL::opAnd |
( |
|
$attributes, |
|
|
|
$rule |
|
) |
| |
|
staticprivate |
'and' match operator.
- Parameters
-
array | $attributes | The attributes of an user. |
array | $rule | The rule we should check. |
- Returns
- boolean TRUE if the rule matches, FALSE if not.
Definition at line 134 of file ACL.php.
134 {
135
136 foreach (
$rule as $subRule) {
138 return FALSE;
139 }
140 }
141
142
143 return TRUE;
144 }
References $attributes, and $rule.
Referenced by match().
◆ opEquals()
static sspmod_core_ACL::opEquals |
( |
|
$attributes, |
|
|
|
$rule |
|
) |
| |
|
staticprivate |
'equals' match operator.
- Parameters
-
array | $attributes | The attributes of an user. |
array | $rule | The rule we should check. |
- Returns
- boolean TRUE if the rule matches, FALSE if not.
Definition at line 154 of file ACL.php.
154 {
155
156 $attributeName = array_shift(
$rule);
157
158 if (!array_key_exists($attributeName,
$attributes)) {
159 $attributeValues = array();
160 } else {
162 }
163
164 foreach (
$rule as $value) {
165 $found = FALSE;
166 foreach ($attributeValues as
$i => $v) {
167 if ($value !== $v) {
168 continue;
169 }
170 unset($attributeValues[
$i]);
171 $found = TRUE;
172 break;
173 }
174 if (!$found) {
175 return FALSE;
176 }
177 }
178 if (!empty($attributeValues)) {
179
180 return FALSE;
181 }
182
183
184 return TRUE;
185 }
References $attributes, $i, and $rule.
Referenced by match().
◆ opEqualsPreg()
static sspmod_core_ACL::opEqualsPreg |
( |
|
$attributes, |
|
|
|
$rule |
|
) |
| |
|
staticprivate |
'equals-preg' match operator.
- Parameters
-
array | $attributes | The attributes of an user. |
array | $rule | The rule we should check. |
- Returns
- boolean TRUE if the rule matches, FALSE if not.
Definition at line 195 of file ACL.php.
195 {
196
197 $attributeName = array_shift(
$rule);
198
199 if (!array_key_exists($attributeName,
$attributes)) {
200 $attributeValues = array();
201 } else {
203 }
204
205 foreach (
$rule as $pattern) {
206 $found = FALSE;
207 foreach ($attributeValues as
$i => $v) {
208 if (!preg_match($pattern, $v)) {
209 continue;
210 }
211 unset($attributeValues[
$i]);
212 $found = TRUE;
213 break;
214 }
215 if (!$found) {
216 return FALSE;
217 }
218 }
219
220 if (!empty($attributeValues)) {
221
222 return FALSE;
223 }
224
225
226 return TRUE;
227 }
References $attributes, $i, and $rule.
Referenced by match().
◆ opHas()
static sspmod_core_ACL::opHas |
( |
|
$attributes, |
|
|
|
$rule |
|
) |
| |
|
staticprivate |
'has' match operator.
- Parameters
-
array | $attributes | The attributes of an user. |
array | $rule | The rule we should check. |
- Returns
- boolean TRUE if the rule matches, FALSE if not.
Definition at line 237 of file ACL.php.
237 {
238
239 $attributeName = array_shift(
$rule);
240
241 if (!array_key_exists($attributeName,
$attributes)) {
242 $attributeValues = array();
243 } else {
245 }
246
247 foreach (
$rule as $value) {
248 if (!in_array($value, $attributeValues, TRUE)) {
249 return FALSE;
250 }
251 }
252
253
254 return TRUE;
255 }
References $attributes, and $rule.
Referenced by match().
◆ opHasPreg()
static sspmod_core_ACL::opHasPreg |
( |
|
$attributes, |
|
|
|
$rule |
|
) |
| |
|
staticprivate |
'has-preg' match operator.
- Parameters
-
array | $attributes | The attributes of an user. |
array | $rule | The rule we should check. |
- Returns
- boolean TRUE if the rule matches, FALSE if not.
Definition at line 265 of file ACL.php.
265 {
266
267 $attributeName = array_shift(
$rule);
268
269 if (!array_key_exists($attributeName,
$attributes)) {
270 $attributeValues = array();
271 } else {
273 }
274
275 foreach (
$rule as $pattern) {
276 $matches = preg_grep($pattern, $attributeValues);
277 if (count($matches) === 0) {
278 return FALSE;
279 }
280 }
281
282
283 return TRUE;
284 }
References $attributes, and $rule.
Referenced by match().
◆ opOr()
static sspmod_core_ACL::opOr |
( |
|
$attributes, |
|
|
|
$rule |
|
) |
| |
|
staticprivate |
'or' match operator.
- Parameters
-
array | $attributes | The attributes of an user. |
array | $rule | The rule we should check. |
- Returns
- boolean TRUE if the rule matches, FALSE if not.
Definition at line 294 of file ACL.php.
294 {
295
296 foreach (
$rule as $subRule) {
298 return TRUE;
299 }
300 }
301
302
303 return FALSE;
304 }
References $attributes, and $rule.
Referenced by match().
◆ $acl
The documentation for this class was generated from the following file:
- libs/composer/vendor/simplesamlphp/simplesamlphp/modules/core/lib/ACL.php