hi,

drop by to ask if anyone else is interested in having per-role permissions for attaching images with the image_attach mod.

This would be usefull in all sites where content is submitted by users, but only priviledged users can actually upload images (applications thinkable of are many).

I see this is possible for other modules involved in "attaching" (to take the most famous one, see the core Upload mod), so maybe it could be relatively easy to fit this into image_attach?

cheers,

-Marco

Comments

marcoBauli’s picture

Title: Image_attach permissions » Image_attach granular permissions

or what about per-role / per-contenttype granular permissions?

drewish’s picture

marking http://drupal.org/node/146214 as a duplicate

joachim’s picture

http://drupal.org/node/210402 is a duplicate.

Here's my comments from there:

My suggestion would be:

- 'attach images' for whether the user can pick an image node to attach or change the attached image
- use the 'create image content' to determine whether a user may upload a new image

Is a distinction needed between picking an image node to attach and changing an existing attachment?

rosenhauer’s picture

Sorry for double posting this but I'm not sure what post to add this to since there are several that reference each other as duplicates.

All of the links to "Dupe" items don't have a solution either.

I need to have it so that 1 user (with role A) can create a node and then user 2 (with role B) can add images to it. But unregistered and other roles will only be able to see it and not make updates.

Is this possible?

joachim’s picture

We mark issues as duplicates to keep the issue list sane -- duplicates are identical or nearly and can be ignored.

There's no solution yet because this is a request for a new feature, and someone needs to do the coding.

In your case, can role B edit the node? If so, what's requested here will work for you. If you want role B to be unable to edit node content, you'll need even finer granularity.

drewish’s picture

marked #243276: Image attach permissions as a duplicate

madbits’s picture

I need this too.

joachim’s picture

Leeteq’s picture

#3: "Is a distinction needed between picking an image node to attach and changing an existing attachment?"

Yes, that would definetely be preferable on some sites.

David Stosik’s picture

Assigned: Unassigned » David Stosik
Status: Active » Needs review
StatusFileSize
new7.35 KB

Here is a patch.
Actually, it does a lot more, correcting some bugs when "Attach existing images" is disabled:
* impossible to attach more than one image
* the image is created but not attached at all

Just as a note (principally for me):
if !user_access('attach images') : display nothing
else: if user_access('create images') OR attach_existing_images : display the form

if attach_existing_images: the select list should contain all image nodes
else: it should only contain already attached nodes

That's all for me at the drupalcon sprint code, but I'll try to help comitting this one (and more), if needed. :)

Regards,
David

joachim’s picture

Status: Needs review » Fixed
StatusFileSize
new7.13 KB

Committed with minor comment tweaks and with this bit removed from the patch:

-      unset($node->iids[0]);
+      //unset($node->iids[0]);

Thanks for all your help at the image code sprint today! We've managed to get so much done :)

Status: Fixed » Closed (fixed)

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

gerhard killesreiter’s picture

Status: Closed (fixed) » Active

To which branch was this committed? I can't find it in the latest beta.

joachim’s picture

Status: Active » Closed (fixed)

I see it right here in CVS HEAD.
Unless the beta has very badly misrolled, it should be in there too. (If that's the case file a critical please!)

gerhard killesreiter’s picture

sorry, was on coffee withdrawal. :p

aaronbauman’s picture

Status: Closed (fixed) » Needs review
StatusFileSize
new2.42 KB

I see the patch in this thread was committed, but it's not the feature I was expecting. With a subject "Image_attach granular permissions", I expected to see a change to permissions -- admin/user/permissions -- e.g. at the very least a "attach existing images". But alas, it's still only a globally configurable setting. In other words the question from #3 and #9 was never addressed:

"Is a distinction needed between picking an image node to attach and changing an existing attachment?" My answer is yes, and the attach patch provides the fix.

In this patch:

  • New permission: "attach existing images". In addition to the global "Enable Attach Existing" setting, this permission must be for each role that should be able to attach existing images.
  • hook_update for backwards compatibility: Since there was previously no distinction between "attach images" and "attach existing images", this hook_update adds "attach existing images" permission to every role that already has "attach images". This will create an uninterrupted update experience for image_attach users.

Apologies if I was not supposed to reopen this issue, but i thought it was pertinent.
Please let me know if i should put this in a new request.

Status: Needs review » Needs work

The last submitted patch, 72579-image_attach_existing_permission.patch, failed testing.

joachim’s picture

Status: Needs work » Closed (fixed)

Hmmm... seems reasonable, but this should be in a new issue -- can you file one please?

aaronbauman’s picture