You are here

function filebrowser_access in Filebrowser 6.2

hook_access implementation.

File

./filebrowser.module, line 445

Code

function filebrowser_access($op, $node, $account) {
  if ($op == 'create') {
    if (user_access(FILEBROWSER_CREATE_DIRECTORY_LISTING, $account)) {
      return TRUE;
    }
  }
  if ($op == 'view') {
    if (user_access(FILEBROWSER_VIEW_DIRECTORY_LISTINGS, $account)) {
      return TRUE;
    }
  }
  if ($op == 'update') {
    if (user_access(FILEBROWSER_EDIT_ANY_DIRECORY_LISTINGS, $account)) {
      return TRUE;
    }
    if (user_access(FILEBROWSER_EDIT_OWN_DIRECTORY_LISTINGS, $account) && $account->uid == $node->uid) {
      return TRUE;
    }
  }
  if ($op == 'delete') {
    if (user_access(FILEBROWSER_DELETE_ANY_DIRECTORY_LISTINGS, $account)) {
      return TRUE;
    }
    if (user_access(FILEBROWSER_DELETE_OWN_DIRECTORY_LISTINGS, $account) && $account->uid == $node->uid) {
      return TRUE;
    }
  }
}