Browse Source

Fixed a warning in SecurityClass.inc

In SecurityClass.inc it is possible to get the warnings:
warning: Invalid argument supplied for foreach() in /var/www/sites/all/modules/fedora_repository/SecurityClass.inc on line 84.
warning: Invalid argument supplied for foreach() in /var/www/sites/all/modules/fedora_repository/SecurityClass.inc on line 89.

These happen when the XACML policy doesn't contain any roles or users.
pull/66/head
jonathangreen 13 years ago
parent
commit
cedc2f6dd4
  1. 4
      SecurityClass.inc

4
SecurityClass.inc

@ -81,12 +81,16 @@ class SecurityClass {
$roles = $xml->xpath('//default:SubjectAttributeDesignator[@AttributeId="fedoraRole"]/../default:Apply/default:AttributeValue');
$users = $xml->xpath('//default:SubjectAttributeDesignator[@AttributeId="urn:fedora:names:fedora:2.1:subject:loginId"]/../default:Apply/default:AttributeValue');
if($roles) {
foreach($roles as $role) {
$allowedRoles[] = (string)$role;
}
}
if($users) {
foreach($users as $user) {
$allowedUsers[] = (string)$user;
}
}
$usersAndRoles['users'] = $allowedUsers;
$usersAndRoles['roles'] = $allowedRoles;

Loading…
Cancel
Save