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
Comment #1
dbeall commentedI 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.
Comment #2
dbeall commentedI 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...
Comment #3
dbeall commentedscanning 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
Comment #4
Manamarak commenteddbeall 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.
Comment #5
dbeall commentedI 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.
Comment #6
dbeall commentedi 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.
Comment #7
Manamarak commentedPHP 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.
Comment #8
dbeall commentedGiving users permission to post in albums they did not create or a Shared Gallery
One condition: From Original Post..
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.
Comment #9
dbeall commentedBTW,, 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....
Comment #10
dbeall commentedI 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
Comment #11
Manamarak commentedYou 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.
Comment #12
dbeall commentedit'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.
Comment #13
Manamarak commentedHi 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.
Comment #14
dbeall commentedThat'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.
Comment #15
dbeall commentedchange title to clarify or enhance, change status and assign to self for documentation
Comment #16
dbeall commented@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
Comment #18
joachim commentedI'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.
Comment #19
dbeall commentedI 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
Comment #20
joachim commentedI'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.
Comment #21
L3na commentedHaving this issue too. Subscribing to thread in the hopes of seeing a code fix.
@ Dbeal: thanks a million for the temporary fix.
Comment #22
BetaTheta commentedsubscribing - hoping this eventually becomes a feature (which would be awesome!)
Comment #23
dddave commentedI 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?
Comment #24
dddave commentedOh: this one sounds similar: #1012514: A Gallery specially created for Blog/Story
Comment #25
scroogie commentedSo 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.
Comment #26
joachim commenteda) 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.
Comment #27
scroogie commentedOkay, 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
Comment #28
justintime commentedI see 3 possibilities:
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.
Comment #29
Canadaka commentedAny of these options would be nice, per gallery access would be best IMO.
Comment #30
scroogie commentedThe "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.
Comment #31
scroogie commentedMhm, 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.
Comment #32
justintime commented@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.
Comment #33
justintime commentedand 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.
Comment #34
dereckd commentedI 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)
Comment #35
scroogie commentedThanks 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.
Comment #36
justintime commentedMoving this over to node_gallery_access' queue. If you need something in the interim, check out the issue mentioned in #35.
Comment #37
rasheemo commentedI 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.
Comment #38
scroogie commentedJust 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).
Comment #39
calumet commentedSorry, 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)
Comment #40
calumet commentedAlso tested with 6.x-3.x-dev, the same issue.
Comment #41
calumet commentedsorry, this seems a bug in node gallery itself, so I'm sumbitting a bug report in its issue queue
Comment #42
scroogie commentedcalumet: Could you check if this is still a problem in the latest Node Gallery?
Comment #43
finnhappy commentedI tested the latest release 6.x-3.x-dev, the same issue. Did you find some solution?
Comment #44
scroogie commentedCan you tell me which permissions you gave exactly? The functionality should be there already!