function invite_access in Invite 7.4
Access callback for invite type.
Parameters
object $invite: Either an invite entity or in case $op is 'create' either an entity or an invite type name.
Return value
bool TRUE/FALSE for access.
See also
1 call to invite_access()
- invite_form in includes/
invite.admin.inc - Invite Form.
2 string references to 'invite_access'
- invite_entity_info in ./
invite.module - Implements hook_entity_info().
- invite_menu in ./
invite.module - Implements hook_menu().
File
- ./
invite.module, line 375
Code
function invite_access($op, $invite = NULL, $account = NULL, $entity_type = NULL) {
global $user;
if (!isset($account)) {
$account = $user;
}
switch ($op) {
case 'create':
$type = isset($invite) && is_object($invite) ? $invite->type : $invite;
return user_access('administer invite entities', $account) || user_access('create any invite entities', $account) || user_access('create ' . $type . ' entity');
case 'view':
return user_access('administer invite entities', $account) || user_access('view any invite entities', $account) || $invite->uid == $account->uid;
case 'edit':
return user_access('administer invite entities') || user_access('edit any invite entities') || isset($invite) && (user_access('edit own invite entities') && $invite->uid == $account->uid);
case 'withdraw':
return user_access('withdraw invitations') || isset($invite) && (user_access('edit own invite entities') && $invite->invitee == $account->uid);
}
return TRUE;
}