You are here

function media_crop_image_access in Media crop 7

Access callback for media_crop/*.

1 call to media_crop_image_access()
media_crop_media_format_form_prepare_alter in ./media_crop.module
Implements hook_media_format_form_prepare_alter().
1 string reference to 'media_crop_image_access'
media_crop_menu in ./media_crop.module
Implements hook_menu().

File

./media_crop.module, line 508
Media crop primary module file.

Code

function media_crop_image_access($file, $account = NULL) {
  if ($account === NULL) {
    global $user;
    $account = $user;
  }

  // Anyone can crop their own files, but to crop other people's private files,
  // they need to be an admin, and to crop other people's public files,
  // they need to be able to both view and edit media.
  return $file->uid === $account->uid || (strpos($file->uri, 'private://') === 0 ? user_access('administer media') : media_access('view') && media_access('edit'));
}