function _simplesamlphp_auth_evaulaterolerule in simpleSAMLphp Authentication 6.3
Same name and namespace in other branches
- 6.2 simplesamlphp_auth.module \_simplesamlphp_auth_evaulaterolerule()
- 7.3 simplesamlphp_auth.module \_simplesamlphp_auth_evaulaterolerule()
- 7 simplesamlphp_auth.module \_simplesamlphp_auth_evaulaterolerule()
- 7.2 simplesamlphp_auth.module \_simplesamlphp_auth_evaulaterolerule()
Evaluates a role rule.
Parameters
$roleruleevaluation: An array containing the role rule to evaluate.
$attributes: An array containing the identity attributes.
Return value
An array containing role value and the attribute, or FALSE.
1 call to _simplesamlphp_auth_evaulaterolerule()
- _simplesamlphp_auth_rolepopulation in ./
simplesamlphp_auth.module - Performs role population.
File
- ./
simplesamlphp_auth.module, line 775 - simpleSAMLphp authentication module for Drupal.
Code
function _simplesamlphp_auth_evaulaterolerule($roleruleevaluation, $attributes) {
_simplesaml_auth_debug(t('Evaluate rule (key=%key,operator=%op,value=%val)', array(
'%key' => $roleruleevaluation[0],
'%op' => $roleruleevaluation[1],
'%val' => $roleruleevaluation[2],
)));
if (!array_key_exists($roleruleevaluation[0], $attributes)) {
return FALSE;
}
$attribute = $attributes[$roleruleevaluation[0]];
switch ($roleruleevaluation[1]) {
case '=':
return in_array($roleruleevaluation[2], $attribute);
case '@=':
$dc = explode('@', $attribute[0]);
if (count($dc) != 2) {
return FALSE;
}
return $dc[1] == $roleruleevaluation[2];
}
return FALSE;
}