You are here

function gallery_assist_check_access in Gallery Assist 6

Same name and namespace in other branches
  1. 7 gallery_assist.module \gallery_assist_check_access()
14 calls to gallery_assist_check_access()
gallery_assist_delete in ./gallery_assist.module
Implementation of hook_delete().
gallery_assist_delete_one in ./gallery_assist.module
Add to the form the data from the image that will be deleted. Menu callback which is activated by clicking on the link delete over the images.
gallery_assist_display_item_default in ./gallery_assist.module
Build the output to display each gallery image. Call the own pager and the theme.
gallery_assist_edit_one in ./gallery_assist.module
Allow to edit each Gallery Assist Item separately.
gallery_assist_file_download in ./gallery_assist.module
Implementation of hook_file_download.

... See full list

1 string reference to 'gallery_assist_check_access'
gallery_assist_menu in ./gallery_assist.module
Implementation of hook_menu().

File

./gallery_assist.module, line 1985
Drupal content type with gallery functionality.

Code

function gallery_assist_check_access($node, $op = 'view') {
  global $user;
  switch ($op) {
    case 'view':
      if ($user->uid == $node->uid) {
        if (user_access('view gallery_assist content') || user_access('view gallery_assist_' . $node->type . ' content')) {
          return TRUE;
        }
        else {
          return FALSE;
        }
      }
      else {
        if (user_access('view gallery_assist content') || user_access('view gallery_assist_' . $node->type . ' content')) {
          if (module_exists('user_relationship_node_access') && $node->ga_public_status == 'ur') {
            return gallery_assist_check_ur($node, 'view');
          }
          else {
            return TRUE;
          }
        }
        else {
          return FALSE;
        }
      }
    case 'edit':
      if ($user->uid == $node->uid) {
        if (user_access('edit own gallery_assist content') || user_access('edit own gallery_assist_' . $node->type . ' content')) {
          return TRUE;
        }
        else {
          return FALSE;
        }
      }
      else {
        if (user_access('edit any gallery_assist content') || user_access('edit any gallery_assist_' . $node->type . ' content')) {
          return TRUE;
        }
        else {
          if (module_exists('user_relationship_node_access') && $node->ga_public_status == 'ur') {
            return gallery_assist_check_ur($node, 'update');
          }
          else {
            return FALSE;
          }
        }
      }
    case 'delete':
      if ($user->uid == $node->uid) {
        if (user_access('delete own gallery_assist content') || user_access('delete own gallery_assist_' . $node->type . ' content')) {
          return TRUE;
        }
        else {
          return FALSE;
        }
      }
      else {
        if (user_access('delete any gallery_assist content') || user_access('delete any gallery_assist_' . $node->type . ' content')) {
          return TRUE;
        }
        else {
          if (module_exists('user_relationship_node_access') && $node->ga_public_status == 'ur') {
            return gallery_assist_check_ur($node, 'delete');
          }
          else {
            return FALSE;
          }
        }
      }
  }
}