You are here

function wsconfig_access in Web Service Data 7

Determines whether the given user has access to a wsconfig.

Parameters

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

object $wsconfig [optional]: Optionally a model or a model type to check access for. If nothing is given, access for all models is determined.

object $account [optional]: The user to check for. Leave it to NULL to check for the global user.

Return value

boolean Return TRUE if the account has access, FALSE otherwise.

2 string references to 'wsconfig_access'
WsConfigUIController::hook_menu in modules/wsconfig/wsconfig.entity.inc
Overrides hook_menu() defaults. Main reason for doing this is that parent class hook_menu() is optimized for entity type administration.
wsconfig_entity_info in modules/wsconfig/wsconfig.module
Implements hook_entity_info().

File

modules/wsconfig/wsconfig.module, line 294
Main module for wsconfig

Code

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