You are here

function autoassignrole_get_active_path_roles in Auto Assign Role 6

Same name and namespace in other branches
  1. 6.2 autoassignrole.module \autoassignrole_get_active_path_roles()
  2. 7.2 autoassignrole.module \autoassignrole_get_active_path_roles()

Get all roles that will be assigned based on the active path

Parameters

$path: string An optional path to use as the active path

Return value

array An array of roles

1 call to autoassignrole_get_active_path_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 613
The main autoassignrole.module file

Code

function autoassignrole_get_active_path_roles($path = NULL) {
  if (!is_array($path)) {
    $path = array(
      $path,
    );
  }
  if (count($path) == 0) {
    $menu_item = menu_get_item();
    $path[] = $menu_item['path'];
  }
  $path_roles = autoassignrole_get_path_roles($path);
  $auto_roles = autoassignrole_get_auto_roles();
  foreach ($auto_roles as $key => $value) {
    $path_roles[$key] = $value;
  }
  return _autoassignrole_clean_roles($path_roles);
}