function group_entity_access in Group 7
Same name and namespace in other branches
- 8 group.module \group_entity_access()
- 2.0.x group.module \group_entity_access()
Entity API access callback for groups.
Parameters
string $op:
Group $group:
object $account:
string $entity_type:
Return value
bool
1 string reference to 'group_entity_access'
- group_entity_info in ./
group.entity.inc - Implements hook_entity_info().
File
- ./
group.entity.inc, line 209 - Contains all Entity API functions for the Group module.
Code
function group_entity_access($op, Group $group = NULL, $account = NULL, $entity_type = NULL) {
// First deal with the case where a group is provided.
if (isset($group)) {
switch ($op) {
case 'create':
return !empty($group->type) && user_access("create {$group->type} group", $account);
case 'view':
return group_access('administer group', $group, $account) || group_access('view group', $group, $account);
case 'update':
return group_access('administer group', $group, $account) || group_access('edit group', $group, $account);
case 'delete':
return group_access('administer group', $group, $account) || group_access('delete group', $group, $account);
}
}
// No group is provided. Check for access to all groups.
if (user_access('bypass group access', $account)) {
return TRUE;
}
return FALSE;
}