Essentially, I would like to know if it is possible to give users permission to post image content in galleries created by other users.

I have a scenario where I want to create an album/image relationship that will serve as a photo competition.

Moderators will be able to create a gallery, which will take the form of a themed competition.

Registered Users must then have the ability to post images in this gallery, even though they have not created the gallery.

Registered Users must not be able to create galleries in this relationship.

Is this possible with the module as it stands, or perhaps with an existing add-on module?

I know I can do this with other modules, but I would rather use Node Gallery as I already use it to create per-user albums.

Comments

dbeall’s picture

I believe the answer is yes. see Comment #8 for my full notes..

When you create a new gallery relationship,
the new gallery and gallery image will have new content types,
add the proper permissions to allow every one in that role to create content.

create photo_competition_gallery content
create photo_competition_image content

You should set up the new relationship and try it first to make sure it does what you need.
The masquerade module can help with testing.
It will let you act as a registered user to post test content.

side note when creating a new relationship, Un-Check the new "gallery image" content type from the "Navigation Menu" to not show it on the create content list.
All the images need to be added through the gallery content type.

If you do not want the users to create a new album using the photo_competition content type, un-check it from the Navigation Menu after you create the competition gallery.
The competitors will navigate to the photo_competition gallery and add photos into the existing gallery using the control links.

dbeall’s picture

I suppose I could lots of details to go with this, but play with it a little bit and try just allowing
(create photo_competition_image content) and see if that will work the way you want...

dbeall’s picture

Category: feature » support

scanning issues, this one is related. #593052: Create permission category that allows "authenticated user" to upload, but not edit gallery

keep in mind, I have not tried this, but will be doing it on one of my sites after the next release.
Maybe this weekend I will get some time to test it as well.

--TESTED

Manamarak’s picture

Category: support » feature

dbeall to the rescue, again.

Well, this works, but not really as it is supposed to.

Just allowing 'create photo_competition_image content' doesn't do anything. I have to also grant 'edit any photo_competition_gallery content'

But as the link in #593052 stated, that does leave authenticated users with the permission to change the Title and Body of the album, which I don't want.

The solution in #593052 doesn't work either, as that changes access 'per node', for a similar solution to be successful, I need it to work 'per field' (thus allowing me to exclude the Body and Title fields)

I can now hide the node edit link using CSS, but that does leave a minor security risk.

What is really needed, IMHO, is that albums can be marked shared, which will greatly expand the capabilities of Node Gallery, as it can then be used as a base for OG galleries.

I suspect, though that this is a job for Node Gallery Access, which I understand is still under heavy development.

dbeall’s picture

I would not go so far as to say "rescue" as I did not provide an answer that works.
I will try to play with this tomorrow after I get some sleep..
There may be a way to fix any editing with a rule set.

I don't know how many images you are expecting for the competition.
For a work around, I suppose you could make a new content type for submissions and add a file field to it.. Then add the images to the gallery as the admin. That is certainly not an automated way to do it, but retains control.

I will report back after messing around with it... maybe we can come up with something.

dbeall’s picture

i should add, it really upsets me that I don't know how to write PHP.. I kick myself every day for that.
I feel like the stupidest person in the whole crowd.

Manamarak’s picture

PHP aint my strong point neither.

Just one more thing, if your not in bed already. I definitely need the contest images to be a unique content type, for reasons best explained by the fact that I want ratings on contests, but not on personal albums.

BUT, when I create a new content type (not renaming the one created by the image module, as I did for the other gallery relationship) the image does not display when I view the node.

The thumbnails display fine, but when I want to view the full node, I come up with a blank screen. Only the title etc displays.

Once I install lightbox, I can view the node in lightbox.

dbeall’s picture

Category: support » feature

Giving users permission to post in albums they did not create or a Shared Gallery

One condition: From Original Post..
Moderators will be able to create a gallery, which will take the form of a themed competition.
This will not work with this setup as each competition gallery will need a new "Gallery Content Type" due to the Title field and the Description. --(needs work)(on the ToDo list)

Note: This entry will get edited as I find errors or add additional notes.........
This has been updated to keep the Gallery Node core Title field intact. So now we just have to add a custom CCK field for the body text or Description. updated instructions below....

Modules used:
node_gallery
content_access (requires rebuild permissions on install)
rules
The masquerade module can help with testing.
It will let you act/switch to a registered user to post test content.

-------------
Note: This is the node gallery relationship to be used for sharing.

Create 2 new gallery content types(gallery and image) normal set up.
permissions granted to all in my test for:
create photo_competition_gallery content
create photo_competition_image content
edit own photo_competition_image content

---------------
Note: This will set up the content type for rules to stop users from changing the Title and/or the Description.

Goto: Administer > Content type > photo_competition_gallery
Remove the text in the core body or description field to disable.
Add a new CCK text area field for description.(photo_comp_description) This is needed for rules to work properly.

---------------------
Create the new shared gallery

Goto: Administer > Create content > photo competition gallery
Enter the Title of the gallery "new photo competition title"
Enter the description of the gallery(new CCK field) "new photo competition description"

After the shared gallery is created. To stop users from creating a new shared gallery.

Goto: Administer > Site building > Menus > List
Open the Navigation menu and un-check the shared gallery and image content types.
In this example:
photo_competition_gallery
photo_competition_image

---------------
Note: These triggered rules will simply reset the title and description to the text that you enter if anyone changes them.

Add a new triggered rule:
(label) " whatever-- photocomp title"
(event) "After updating existing content" (save)

section Rule Elements:
(add a condition) Node: Content has type (next)
(content types) photo competition gallery (save)

section DO:
(Add an action) "set content title" (next)
Enter your actual title text "new photo competition title" (save)
-----
Add a new triggered rule:
(label) " whatever-- photocomp description"
(event) "After updating existing content" (save)

section DO:
(add an action) "Populate a field" "photo_comp_description_field" (continue)
Enter your actual description text "new photo competition description" (save)

-------------
Note: This is where the permissions magic happens. Each authenticated user that adds an image to the gallery will be able to edit their own images. This does not work well for anonymous users as they can edit any image submitted by another anonymous user (unless that edit permission is disabled). This can also be set to allow permissions for specified users by "user name".

Content access, set this for the "user roles" to include:
Goto Administration > Content types > photo_competition_gallery > Access control
View any content: (X anonymous user)(X authenticated user)
Edit any content: (X anonymous user)(X authenticated user)
View own content: (X anonymous user)(X authenticated user)
Edit own content: (X anonymous user)(X authenticated user)

Note to self:
Next item ToDo: change things to make the Title and Description fields non-editable with out rules so moderators can create shared Galleries at any time without a new content type. --(needs work)
Project editablefields might fill the need. --(need to test)

I was getting a system error occasionally but never tracked it down, didn't seem to effect anything.

dbeall’s picture

BTW,, you will also want to remove both of the photo competition content types from the navigation menu after you create the "New Photo Competition Gallery". That way, nobody can create a new one.
--FIXED

EDIT: your blank screen issue had to be permissions....

dbeall’s picture

Title: Giving users permission to post in albums they did not create or a shared gallery » Giving users permission to post in albums they did not create
Component: Documentation » User interface
Assigned: dbeall » Unassigned
Category: task » feature
Status: Needs work » Active

I just figured out you will have to make a new CCK field for the competition photo gallery title too, or rules will reset every title of every content that is edited to the title used in rules.
--FIXED

Manamarak’s picture

You went through a lot of trouble here, thank you very very much.

I am going to try to implement it now and let you know.

dbeall’s picture

it's no trouble, it's more of a learning process and if we can work this out, lots of people will benefit.
The node_access part works fine.
As I think about this, a custom page.tpl and custom node.tpl might be of some use..
I never get the time to mess with theme stuff. In fact, I have only used rules one time and there may be a better way..
please post your findings so we can add this to the handbook.

Manamarak’s picture

Category: feature » support

Hi Dbeall,

Thanks for your solution.

It does work fine and I am going to use it.

I have never used rules before, so I had no idea this was possible.

In short, I couldn't do it without your help.

On a side note, I am going to post a bug report about the blank screen issue, I don't think it is a permissions problem, because the content doesn't show up for admin user either, who should theoretically, as I understand it, have all permissions.

dbeall’s picture

That's great to hear.. I will play with it a bit more within a few days and get something added to the handbook. I just know more people want to do this. I need to have it on BuckeyeLake.org next month too. If I come up with anything new and improved, I most certainly let you know.. Same on your end, good or bad.. let me know.

When i get this posted or documented, I will change the status on this thread.. until then, will use this thread as working notes.

dbeall’s picture

Title: Giving users permission to post in albums they did not create » Giving users permission to post in albums they did not create or a shared gallery
Component: User interface » Documentation
Assigned: Unassigned » dbeall
Category: support » task
Status: Active » Needs work

change title to clarify or enhance, change status and assign to self for documentation

dbeall’s picture

Title: Giving users permission to post in albums they did not create » Giving users permission to post in albums they did not create or a shared gallery
Component: User interface » Documentation
Assigned: Unassigned » dbeall
Category: feature » task
Status: Active » Fixed

@Manamarak, Your issue has created a handbook page, everybody benefits.

The page may grow with a views version in the near future.

I added a credit for you at the end of the page. Thanks for the motivation!

HowTo: Create a Shared Gallery

Status: Fixed » Closed (fixed)

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

joachim’s picture

Component: Documentation » Code
Category: task » feature
Status: Closed (fixed) » Active

I'm sorry but this is a hideously complicate kludge for what should be achievable with an extra permission and a few lines of code in hook_menu's access checks.

Using rules to prevent saving node content is *particularly* ugly.

dbeall’s picture

Assigned: dbeall » Unassigned

I agree completely, the rules workaround was a late night quick solution for a request from last October. shoot this was before justintime started working on the module.

Looking forward to your code fix

joachim’s picture

I'm afraid I'm out of hours on the project I was using this module for -- I tackled the essential fixes first; this was a 'nice to have' which I won't have time to look at.

L3na’s picture

Having this issue too. Subscribing to thread in the hopes of seeing a code fix.

@ Dbeal: thanks a million for the temporary fix.

BetaTheta’s picture

subscribing - hoping this eventually becomes a feature (which would be awesome!)

dddave’s picture

Version: 6.x-2.0-alpha10 » 6.x-3.x-dev
Priority: Minor » Normal

I gave this a quick shot yesterday but did not go into deep. I assumed that NG3 would easily allow for such a behavior in the lines of joachim's comment in #18. I wasn't able to create a single shared gallery. Did I miss something or is this feature still not implemented?

dddave’s picture

scroogie’s picture

So what is exactly desired here? Having an extra permission that allows to put pictures in all galleries globally? Or having special types of galleries into which all users can put photos? Or both mixed, having a permission which allows users to put pictures into a special type of gallery? I'm not sure if everyone is talking about the same goal in this thread.

joachim’s picture

a) Having an extra permission that allows to put pictures in all galleries globally
b) having special types of galleries into which all users can put photos

Option a) is what I think is meant -- certainly it's what the OP says. Also, it's much easier, as it's global. Option b) would require permissions on each gallery.

scroogie’s picture

Okay, thanks joachim. a) is no problem indeed. Let's see what justin says to b), perhaps write access is something to consider for http://drupal.org/project/node_gallery_access

justintime’s picture

I see 3 possibilities:

  • Global Permission: While this is the easiest to do, I'm guessing it's not what our users want. Once a user is granted this permission, they would be able to add images to any gallery on the entire site.
  • Node Gallery Access type: This would allow the user to specify each individual gallery as "shared". If the gallery is of this type, and a user has permissions to create new images of the correct type, then they can add images to the gallery but not edit the gallery metadata itself
  • Global Permission + Per-relationship setting: This is a hybrid approach to the first item above. It has a global permission, but also allows users to limit scope via NG relationships. We could present a checkbox on the relationship settings page that when checked, allows users with the correct permission to add images to any gallery of the correct content type.

My personal opinion is that this feature is more within the scope of node_gallery_access, and it would give users the most flexibility. However, if the first item is indeed what's desired, then we could certainly throw that in for the 3.0 release.

Canadaka’s picture

Any of these options would be nice, per gallery access would be best IMO.

scroogie’s picture

The "Node Gallery Access type" would indeed be the best solution. Justin, what do you think, could you implement this? Otherwise I'll add the global "Post to all galleries permission" now. To all users here, sorry for letting you wait for so long.

scroogie’s picture

Mhm, judging from node_gallery_user_access this global permission already exists: it is 'edit any '. $gallery_type .' content'. At least it is interpreted that way. Don't know if this is on purpose though.

justintime’s picture

@scroogie, the desired feature is to allow the user to add new images to a gallery, but not change the gallery's metadata. The permission you describe fits the first requirement, but fails the second.

justintime’s picture

and regarding #30, I'm pretty sure I can do it, but will likely need to create a hook in ng_user_access() so that I can intercede at the right times. Probably a good thing to have anyway.

dereckd’s picture

I realize this will only work for a very specific scenario, but it is working for mine so I figured it was worth posting. For my purposes I (the admin) will be creating all the shared galleries, I want people to be able to contribute to them but not edit them. I did this

Goto: Administration > Content management > Content types > you_gallery_type > Access control

View any content:
[X] anonymous user
[X] authenticated user

Edit any content:
[ ] anonymous user
[ ] authenticated user

View own content:
[X] anonymous user
[X] authenticated user

Edit own content:
[X] anonymous user
[X] authenticated user

go to line 567 in node_gallery.module and change

return user_access('administer nodes') || user_access('edit any '. $gallery_type .' content');
to
return user_access('administer nodes') || user_access('edit own '. $gallery_type .' content');

essentially what this does is give upload acces (to any gallery) to anyone who can edit there own gallery, they still cannot "edit" the gallery since they only have permission to edit there own. This only works if the admin is the creator or the shared gallery, and if you want to allow user to upload to all the galleries in that content type

I know it's a little hacky, and breaks if the use case is altered, but I figured I would post a possible solution as ashort term fix . . .

(obviously requires the content access module)

scroogie’s picture

Thanks dereckd. Just fyi. For a more general solution, the patch in #1032134: Make NG3 and Ubercart play nice also contains a "upload to all galleries" permission, but it misses any review.

justintime’s picture

Project: Node Gallery » Node Gallery Access

Moving this over to node_gallery_access' queue. If you need something in the interim, check out the issue mentioned in #35.

rasheemo’s picture

I also installed node gallery with the intent of allowing users to upload images to any gallery I (the admin) created. I'd love to know when this feature is added, I've had no luck with hacking it myself, and the only alternative would be to create my view and make a "category" taxonomy and create a view for each category or something.

scroogie’s picture

Just fyi to all subscribers: The "upload to all galleries" permission landed in NG 3.x-dev on 14th march, but is in urgent need of testing (no feedback on the issue).

calumet’s picture

Sorry, the "upload to all galleries" permission doesn't work for me. I give the following permissions to authenticated users:

[x] upload to all galleries
[x] create node_gallery_image content
[x] delete own node_gallery_image content
[x] edit own node_gallery_image content
[x] view node gallery

But users can only publish images in its own galleries. Tested on a clean site (drupal 6.20, node gallery 6.x-3.0-alpha3)

calumet’s picture

Category: feature » bug

Also tested with 6.x-3.x-dev, the same issue.

calumet’s picture

Category: bug » feature

sorry, this seems a bug in node gallery itself, so I'm sumbitting a bug report in its issue queue

scroogie’s picture

calumet: Could you check if this is still a problem in the latest Node Gallery?

finnhappy’s picture

I tested the latest release 6.x-3.x-dev, the same issue. Did you find some solution?

scroogie’s picture

Can you tell me which permissions you gave exactly? The functionality should be there already!