function tripal_library_library_access

1.x tripal_library.module tripal_library_library_access($op, $node, $account)

The following function proves access control for users trying to perform actions on data managed by this module

Related topics

File

tripal_library/tripal_library.module, line 386

Code

function tripal_library_library_access($op, $node, $account) {
  if ($op == 'create') {
    if (!user_access('create chado_library content', $account)) {
      return FALSE;
    }
  }

  if ($op == 'update') {
    if (!user_access('edit any chado_library content', $account) && 
      !user_access('edit own chado_library content', $account)) {
      return FALSE;
    }
    if (user_access('edit own chado_library content', $account) && 
      $account->uid != $node->uid) {
      return FALSE;
    }
  }

  if ($op == 'delete') {
    if (!user_access('delete any chado_library content', $account) && 
      !user_access('delete own chado_library content', $account)) {
      return FALSE;
    }
    if (user_access('delete own chado_library content', $account) && 
      $account->uid != $node->uid) {
      return FALSE;
    }
  }
  return NULL;
}