24 assert(is_string(
$acl) || is_array(
$acl));
26 if (is_string(
$acl)) {
31 if (!is_array($rule)) {
34 if (count($rule) === 0) {
56 assert(is_string(
$id));
75 foreach ($this->acl as
$rule) {
78 if (!self::match($attributes, $rule)) {
100 $op = array_shift($rule);
108 return self::opAnd($attributes, $rule);
110 return self::opEquals($attributes, $rule);
112 return self::opEqualsPreg($attributes, $rule);
114 return self::opHas($attributes, $rule);
116 return self::opHasPreg($attributes, $rule);
118 return !self::match($attributes, $rule);
120 return self::opOr($attributes, $rule);
136 foreach (
$rule as $subRule) {
156 $attributeName = array_shift(
$rule);
158 if (!array_key_exists($attributeName,
$attributes)) {
159 $attributeValues = array();
164 foreach (
$rule as $value) {
166 foreach ($attributeValues as
$i => $v) {
170 unset($attributeValues[
$i]);
178 if (!empty($attributeValues)) {
197 $attributeName = array_shift(
$rule);
199 if (!array_key_exists($attributeName,
$attributes)) {
200 $attributeValues = array();
205 foreach (
$rule as $pattern) {
207 foreach ($attributeValues as
$i => $v) {
208 if (!preg_match($pattern, $v)) {
211 unset($attributeValues[
$i]);
220 if (!empty($attributeValues)) {
239 $attributeName = array_shift(
$rule);
241 if (!array_key_exists($attributeName,
$attributes)) {
242 $attributeValues = array();
247 foreach (
$rule as $value) {
248 if (!in_array($value, $attributeValues, TRUE)) {
267 $attributeName = array_shift(
$rule);
269 if (!array_key_exists($attributeName,
$attributes)) {
270 $attributeValues = array();
275 foreach (
$rule as $pattern) {
276 $matches = preg_grep($pattern, $attributeValues);
277 if (count($matches) === 0) {
296 foreach (
$rule as $subRule) {
static opEqualsPreg($attributes, $rule)
'equals-preg' match operator.
if(!array_key_exists('StateId', $_REQUEST)) $id
static opOr($attributes, $rule)
'or' match operator.
allows(array $attributes)
Match the attributes against the access control list.
static opHasPreg($attributes, $rule)
'has-preg' match operator.
static opAnd($attributes, $rule)
'and' match operator.
__construct($acl)
Initializer for this access control list.
if(array_key_exists('yes', $_REQUEST)) $attributes
static opHas($attributes, $rule)
'has' match operator.
static opEquals($attributes, $rule)
'equals' match operator.
static match(array $attributes, array $rule)
Match the attributes against the given rule.
static getOptionalConfig($filename='config.php', $configSet='simplesaml')
Load a configuration file from a configuration set.
static getById($id)
Retrieve an access control list with the given id.