You are here

function filebrowser_node_access in Filebrowser 8

Same name and namespace in other branches
  1. 8.2 filebrowser.module \filebrowser_node_access()
  2. 7.4 filebrowser.module \filebrowser_node_access()
  3. 7.2 filebrowser.module \filebrowser_node_access()
  4. 7.3 filebrowser.module \filebrowser_node_access()
  5. 3.x filebrowser.module \filebrowser_node_access()

hook_node_access implementation.

File

./filebrowser.module, line 763
Validates file path input on node form

Code

function filebrowser_node_access($node, $op, $account) {
  if ($op == 'view') {
    if (!user_access(FILEBROWSER_VIEW_DIRECORY_LISTINGS, $account)) {
      return FALSE;
    }
  }
  if ($op == 'create') {
    if (!user_access(FILEBROWSER_CREATE_DIRECTORY_LISTING, $account)) {
      return FALSE;
    }
  }
  if ($op == 'update') {
    if (!user_access(FILEBROWSER_EDIT_ANY_DIRECORY_LISTINGS, $account) || !(user_access(FILEBROWSER_EDIT_OWN_DIRECTORY_LISTINGS, $account) && $account->uid == $node->uid)) {
      return FALSE;
    }
  }
  if ($op == 'delete') {
    if (!user_access(FILEBROWSER_DELETE_ANY_DIRECTORY_LISTINGS, $account) || user_access(FILEBROWSER_DELETE_OWN_DIRECTORY_LISTINGS, $account) && $account->uid == $node->uid) {
      return FALSE;
    }
  }
}