You are here

function media_gallery_edit_access_ajax in Media Gallery 7.2

Same name and namespace in other branches
  1. 7 media_gallery.module \media_gallery_edit_access_ajax()

Access callback for AJAX-based gallery editing operations.

Parameters

string $type: The type of item being edited: 'gallery' for an individual gallery or 'collection' for a gallery collection.

mixed $item: For a media gallery, the $node object for that gallery; for gallery collections, the taxonomy term corresponding to the collection.

string $token: A token from drupal_get_token.

1 string reference to 'media_gallery_edit_access_ajax'
media_gallery_menu in ./media_gallery.module
Implements hook_menu().

File

./media_gallery.module, line 479

Code

function media_gallery_edit_access_ajax($type, $item, $token) {
  if (!drupal_valid_token($token, 'media_gallery')) {
    return FALSE;
  }
  switch ($type) {
    case 'gallery':
      return node_access('update', $item);
      break;
    case 'collection':
      return user_access('administer media galleries');
      break;
    default:
      return FALSE;
  }
}