You are here

function redhen_note_access in RedHen CRM 7

Checks note access for various operations.

Parameters

$op: The operation being performed. One of 'view', 'update', 'create' or 'delete'.

$note: Optionally a note to check access for or for the create operation the note type. If nothing is given access permissions for all orgs are returned.

$account: The user to check for. Leave it to NULL to check for the current user.

1 call to redhen_note_access()
redhen_note_notes_page in modules/redhen_note/includes/redhen_note.pages.inc
1 string reference to 'redhen_note_access'
redhen_note_menu in modules/redhen_note/redhen_note.module
Implements hook_menu().

File

modules/redhen_note/redhen_note.module, line 147
Redhen Notes main module

Code

function redhen_note_access($op, $parent_entity, $account = NULL) {
  if (entity_access($op, $parent_entity
    ->entityType(), $parent_entity, $account)) {
    if (user_access('administer redhen notes', $account)) {
      return TRUE;
    }
    if ($op == 'view' && user_access('access redhen notes', $account)) {
      return TRUE;
    }
    if (($op == 'edit' || $op == 'create' || $op == 'delete') && user_access('manage redhen notes', $account)) {
      return TRUE;
    }
  }
  return FALSE;
}