You are here

public function ImageCrop::hasUserAccess in Image javascript crop 7

Check if a user has permissions to crop the current file.

Parameters

object $account: The user whose access you want to check

File

includes/imagecrop.class.inc, line 323
Imagecrop class to handle the javascript imagecrop.

Class

ImageCrop
@file Imagecrop class to handle the javascript imagecrop.

Code

public function hasUserAccess($account) {

  // User has access to all images
  if (user_access('crop any image', $account) || user_access('administer nodes', $account)) {
    return TRUE;
  }

  // User has access to this specific image
  if ($this->file && user_access('crop own images', $account) && $account->uid == $this->file->uid) {
    return TRUE;
  }
  return FALSE;
}