You are here

function party_activity_access in Party 8.2

Same name and namespace in other branches
  1. 7 modules/party_activity/party_activity.module \party_activity_access()

Determines whether the given user has access to an activity

Parameters

$op: The operation being performed. One of 'view', 'update', 'create', 'delete' or just 'edit' (being the same as 'create' or 'update').

$activity: Optionally an activity or an activity type to check access for. If nothing is given, access for all models 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 calls to party_activity_access()
party_activity_handler_delete_link_field::render in modules/party_activity/views/party_activity_handler_delete_link_field.inc
party_activity_handler_edit_link_field::render in modules/party_activity/views/party_activity_handler_edit_link_field.inc
2 string references to 'party_activity_access'
PartyActivityUIController::hook_menu in modules/party_activity/party_activity.admin.inc
Overrides hook_menu() defaults. Main reason for doing this is that parent class hook_menu is optimized for entity type administration.
party_activity_entity_info in modules/party_activity/party_activity.module
Implements hook_entity_info().

File

modules/party_activity/party_activity.module, line 123
Functions and important hooks for the party_activity module

Code

function party_activity_access($op, $party_activity = NULL, $account = NULL) {
  if (user_access('administer activities', $account)) {
    return TRUE;
  }
  if (isset($party_activity) && ($type_name = $party_activity->type)) {
    $op = $op == 'view' ? 'view' : 'edit';
    if (user_access("{$op} any {$type_name} activity", $account)) {
      return TRUE;
    }
  }
  return FALSE;
}