You are here

function _crm_core_contact_resource_access in CRM Core 7

Determine whether the current user can access a crm_core_contact resource.


string $op: Operation, access for which should be checked.

mixed $arg: Contact ID or contact data array, in case $op is 'create'.

Return value

bool Boolean.

See also


1 string reference to '_crm_core_contact_resource_access'
crm_core_contact_services_resources in modules/crm_core_contact/crm_core_contact.module
Implements hook_services_resources().


modules/crm_core_contact/includes/, line 21
Resource definitions for services module.


function _crm_core_contact_resource_access($op, $arg) {
  if (is_array($arg[0])) {
    $contact_data = array_shift($arg);
    return crm_core_contact_access($op, $contact_data['type']);
  elseif (is_numeric($arg[0])) {
    $crm_core_contact = crm_core_contact_load($arg[0]);
    return crm_core_contact_access($op, $crm_core_contact);
  elseif (!isset($arg)) {
    return user_access('administer crm_core_contact entities') || user_access('view any crm_core_contact entity');
  return FALSE;