function environment_indicator_check_access in Environment Indicator 7.2
Same name and namespace in other branches
- 8.2 environment_indicator.module \environment_indicator_check_access()
Helper function to check access to show the indicator.
Parameters
array $environment_info: The environment info array.
Return value
bool TRUE if the user can see the indicator.
3 calls to environment_indicator_check_access()
- environment_indicator_admin_menu_output_alter in ./
environment_indicator.module - Implements hook_admin_menu_output_alter().
- environment_indicator_navbar in ./
environment_indicator.module - Implements hook_navbar().
- environment_indicator_page_build in ./
environment_indicator.module - Implements hook_page_build().
File
- ./
environment_indicator.module, line 501 - Module implementation file.
Code
function environment_indicator_check_access($environment_info) {
// Do not show the indicator on select pages.
$off_pages = variable_get('environment_indicator_suppress_pages', "");
$path = drupal_get_path_alias($_GET['q']);
// Compare with the internal and path alias (if any).
$page_match = drupal_match_path($path, $off_pages);
if ($path != $_GET['q']) {
$page_match = $page_match || drupal_match_path($_GET['q'], $off_pages);
}
if ($page_match) {
return FALSE;
}
return user_access('access environment indicator') || user_access('access environment indicator ' . $environment_info['machine']);
}