You are here

function invoice_access in Invoice 6

Implementation of hook_access()

Parameters

string $op:

object $node:

object $account:

Return value

boolean

File

./invoice.module, line 169
Invoice module

Code

function invoice_access($op, $node, $account) {
  if ($op == 'view') {
    return user_access('access invoices', $account);
  }
  if ($op == 'create') {
    if (user_access('administer invoices', $account) || user_access('administer own invoices', $account)) {
      return TRUE;
    }
  }
  if ($op == 'update') {
    if (user_access('administer invoices', $account) || user_access('administer own invoices', $account) && $account->uid == $node->uid) {
      return TRUE;
    }
  }
  if ($op == 'delete') {
    if (user_access('administer invoices', $account) || user_access('administer own invoices', $account) && $account->uid == $node->uid) {
      return TRUE;
    }
  }
}