Just installed 7.x-1.0-rc1, and I have a problem where only the super user get's the link. I already gave permission to the other roles and cleared cache, but the link to crop the image is not showing up.

CommentFileSizeAuthor
#3 admin-1085758.patch963 bytesnils.destoop

Comments

olrandir’s picture

I'm having the same problem. In fact, I have 3 admin users on my installation, and only the admin user who installed the module sees the crop link under the image field (and before uploading an image, he is the only user who sees the text "After uploading an image you'll be able to crop it."). Permissions are all OK. Any ideas?

olrandir’s picture

Temporary solution: in the folder where you installed the module (this should be sites/all/modules/imagecrop), open the file imagecrop.module. Go to line number 185, where you'll find this code snippet:

  // Leave element when user doesn't have access.
   if (!user_access('crop images with toolbox')) {
     return $element;
   }

Comment out this section, like so:

  // Leave element when user doesn't have access.
  // if (!user_access('crop images with toolbox')) {
    // return $element;
  // }

This will remove user access control and effectively allow anyone with access to the link to crop images.

Make certain this is safe in your configuration! In my case the users that can upload images are the same ones that should be able to crop them, if this is not the case for you be advised that this will give everyone with image upload permission the ability to crop them as well.

nils.destoop’s picture

StatusFileSize
new963 bytes

A fix is committed, attached you also can find a patch.

nils.destoop’s picture

Status: Active » Fixed
olrandir’s picture

FYI zuuperman, while I'm glad you found my code snippet to be of use, be advised that this breaks intended functionality: changing the permissions for who can crop images does not have an effect since these are no longer checked against. It's usable, and one might argue better than the previous situation while inserting a not so serious security risk, but still needs fixing! This is why I labeled it as a temporary solution.

Many thanks for evaluating my code and considering the issue though.

edit: oops, just realised your patch actually fixes the issue I'm mentioning. Sorry for the misunderstanding!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jjkiesch’s picture

For consistency shouldn't you just use if (!imagecrop_has_access()) ?