function entity_rules_overview_access in Entity Rules 7
Access callback for overview admin screen.
This screen allows administer Entity Rules with access to Bundle admin pages
Return value
bool
1 string reference to 'entity_rules_overview_access'
- entity_rules_menu in ./
entity_rules.module - Implements hook_menu().
File
- ./
entity_rules.module, line 250 - Module file for the Entity Rules.
Code
function entity_rules_overview_access() {
$permission = variable_get('entity_rules_permissions', ENTITY_RULES_DEFAULT_PERMISSIONS);
$enabled_types = variable_get('entity_rules_types', explode(',', ENTITY_RULES_DEFAULT_TYPES));
if ($permission == 'none') {
return FALSE;
}
if ($permission == 'single') {
return user_access('administer entity_rules settings');
}
if ($permission == 'entity_type') {
// If permissions are set by entity type then check to see if access to any
$entity_infos = entity_get_info();
$entity_infos = array_intersect_key($entity_infos, array_flip($enabled_types));
foreach ($entity_infos as $entity_type => $entity_info) {
if (user_access("administer {$entity_type} entity_rules settings")) {
return TRUE;
}
}
}
return FALSE;
}