You are here

function filebrowser_node_access in Filebrowser 7.3

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

hook_node_access implementation.

File

./filebrowser.module, line 1033

Code

function filebrowser_node_access($node, $op, $account) {
  if ($op == 'view') {
    if (!user_access(FILEBROWSER_VIEW_DIRECTORY_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_DIRECTORY_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;
    }
  }
}