function eck__multiple_access_check in Entity Construction Kit (ECK) 7.2
Same name and namespace in other branches
- 7.3 eck.module \eck__multiple_access_check()
Callback for checking multiple permissions.
Parameters
array $perms: An array of permissions to be checked against.
bool $b_own: (optional) Flag to indicate if we should also check ownership permissions which are the same as the usual permissions, but will be postfixed with ' own'. Defaults to FALSE.
object $account: (optional) The account to check permissions against. Defaults to the current user.
4 calls to eck__multiple_access_check()
- eck__bundle__list in ./
eck.bundle.inc - Page call back for the bundle overview table.
- eck__entity_access in ./
eck.module - Default access callback for ECK entities.
- eck__entity_type__list in ./
eck.entity_type.inc - Callback for the entity_type overview.
- eck__entity__list in ./
eck.entity.inc - Entity overview page callback.
4 string references to 'eck__multiple_access_check'
- eck__bundle__menu in ./
eck.bundle.inc - This function creates the menu items relevant to bundle administration.
- eck__entity_type__info in ./
eck.entity_type.inc - Generate the entity info for a specific entity.
- eck__entity_type__menu in ./
eck.entity_type.inc - Passthrough from hook_menu().
- eck__entity__menu in ./
eck.entity.inc - Entity related menu items.
File
- ./
eck.module, line 605
Code
function eck__multiple_access_check($perms, $b_own = FALSE, $account = NULL) {
if (!isset($account)) {
$account = $GLOBALS['user'];
}
foreach ($perms as $perm) {
if (user_access($perm, $account)) {
return TRUE;
}
}
if (!$b_own) {
return FALSE;
}
// Check for entity author field and user ownership permissions.
foreach ($perms as $perm) {
if (user_access($perm . ' own', $account)) {
return TRUE;
}
}
// The user does not have any of the supplied permissions.
return FALSE;
}