You are here

function patron_access in Library 6

Same name and namespace in other branches
  1. 5.2 patron/patron.module \patron_access()

Implemenation of hook_access().

File

patron/patron.module, line 81

Code

function patron_access($op, $node, $account) {
  if ($op == 'view') {

    //Come back and change this to change patron_uid
    if (user_access('view patron content', $account) || variable_get('patron_is_user', PATRON_NOT_USER) == PATRON_USER && $account->uid == $node->patron_uid) {
      return TRUE;
    }
    else {
      return FALSE;
    }
  }
  if ($op == 'create') {
    return user_access('create patron content', $account);
  }
  if ($op == 'update') {
    if (user_access('edit any patron content', $account) || variable_get('patron_is_user', PATRON_NOT_USER) == PATRON_USER && user_access('edit own patron content', $account) && $account->uid == $node->patron_uid) {
      return TRUE;
    }
  }
  if ($op == 'delete') {
    return user_access('delete patron content', $account);
  }
}