You are here

function pollim_access in Poll Improved 7

Determines whether the given user has access to a pollim.

Parameters

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

$pollim: Optionally a pollim or a pollim type to check access for. If nothing is given, access for all pollims 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 pollim_access()
pollim_handler_delete_link_field::render in views/pollim_handler_delete_link_field.inc
Render the field.
pollim_handler_edit_link_field::render in views/pollim_handler_edit_link_field.inc
Render the field.
2 string references to 'pollim_access'
PollimUIController::hook_menu in ./pollim.admin.inc
Overrides hook_menu() defaults. Main reason for doing this is that parent class hook_menu() is optimized for entity type administration.
pollim_entity_info in ./pollim.module
Implement hook_entity_info().

File

./pollim.module, line 164
Module for the Pollim Entity - a starting point to create your own Entity and associated administration interface

Code

function pollim_access($op, $pollim = NULL, $account = NULL) {
  if (user_access('administer pollims', $account)) {
    return TRUE;
  }
  if (isset($pollim) && is_object($pollim) && ($type_name = $pollim->type)) {
    $op = $op == 'view' ? 'view' : 'edit';
    if (user_access("{$op} any {$type_name} pollim", $account)) {
      return TRUE;
    }
  }
  return FALSE;
}