function config_pages_access in Config Pages 7
Determines whether the given user has access to a config_pages.
Parameters
$op: The operation being performed. One of 'view', 'update', 'create', 'delete' or just 'edit' (being the same as 'create' or 'update').
$config_pages: Optionally a config_pages or a config_pages type to check access for. If nothing is given, access for all config_pagess is determined.
$account: The user to check for. Leave it to NULL to check for the global user.
Return value
boolean Whether access is allowed or not.
2 string references to 'config_pages_access'
- ConfigPagesUIController::hook_menu in ./
config_pages.admin.inc - Overrides hook_menu() defaults. Main reason for doing this is that parent class hook_menu() is optimized for entity type administration.
- config_pages_entity_info in ./
config_pages.module - Implement hook_entity_info().
File
- ./
config_pages.module, line 287 - This module is based on Model module (https://drupal.org/project/model) and most of the comments left untouched but have entity types renamed. Suuport for features added.
Code
function config_pages_access($op, $config_pages = NULL, $account = NULL) {
if (user_access('administer config_pagess', $account)) {
return TRUE;
}
if (is_string($config_pages)) {
$tmp = explode(' ', $config_pages);
$type_name = array_pop($tmp);
}
if (is_object($config_pages) && !empty($config_pages->type)) {
$type_name = $config_pages->type;
}
if (!empty($type_name)) {
// Edit / Update options.
if (in_array($op, array(
'edit',
'update',
))) {
return user_access("edit any {$type_name} config_pages", $account);
}
elseif ($op == 'view') {
return TRUE;
}
}
return FALSE;
}