function autoassignrole_get_all_roles in Auto Assign Role 6
Same name and namespace in other branches
- 6.2 autoassignrole.module \autoassignrole_get_all_roles()
Get all assignable roles that AAR can possibly apply.
Return value
array An array of roles
1 call to autoassignrole_get_all_roles()
- autoassignrole_get_roles in ./
autoassignrole.module - An API like call to return the roles a user has available or will be assigned
File
- ./
autoassignrole.module, line 505 - The main autoassignrole.module file
Code
function autoassignrole_get_all_roles() {
$aar_roles = array();
// Select all auto and user selectable roles
$sql = "SELECT value FROM {autoassignrole} WHERE arid = 'auto_roles' OR arid = 'user_roles'";
$result = db_fetch_object(db_query($sql));
$aar_roles = unserialize($result->value);
// unset anything that isn't active
foreach ($aar_roles as $key => $value) {
if ($value == 0) {
unset($aar_roles[$key]);
}
}
// Select all path assignable roles
$sql = "SELECT rid FROM {autoassignrole_page}";
$result = db_query($sql);
while ($row = db_fetch_object($result)) {
$aar_roles[$row->rid] = $row->rid;
}
return _autoassignrole_clean_roles($aar_roles);
}