Remove "edit permissions" when user add subAlbum
nanodreams
Joined: 2007-10-29
Posts: 3 |
![]() |
Hello I would like to remove the "edit permissions" options when a user add a new Album. Anybody know how make it, Thanks, |
|
25PSi
Joined: 2004-11-28
Posts: 16 |
![]() |
I am in the same boat. I REALLY wish users had no such ability to edit their albums as it seems to be confusing to "Average Joe". I'd much rather prefer that newly created albums by users would inherit permissions and settings of "Parent" album. Kind of "Dumb Out" regular default user and save them from themselves. Can anyone shine some light on this for us? Pls? Thanks Eugene |
|
25PSi
Joined: 2004-11-28
Posts: 16 |
![]() |
c'mon guys! Please!!!! Someone HAS to know!!! Plz? Pretty please? |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
please google the question, it has been discussed before. i guess you'll need the "jens permissions" module or your own module to dynamically set permissions of new albums as they are created. -------------- |
|
nanodreams
Joined: 2007-10-29
Posts: 3 |
![]() |
Hello finally I find the code to make it. Open and edit <install dir>/modules/core/ItemAddAlbum.inc This code remove de "Edit Permissions" only in the album, but if you view a photo y can change the permissions, to remove this option, It's all. |
|
25PSi
Joined: 2004-11-28
Posts: 16 |
![]() |
DUDE!!!! U AWESOME! This IS DA SHIZLE!!! I am just really excited that it worked out. Works great! Now, think you can figure out how to lock them out of Album Edit/Picture Edit once new album/picture had been created? Eugene |
|
nanodreams
Joined: 2007-10-29
Posts: 3 |
![]() |
Hello 25PSi $ret = GalleryCoreApi::removeUserPermission($instance->getId(), If you want to remove the option "Edit", you must add this code $ret = GalleryCoreApi::removeUserPermission($instance->getId(), |
|
steve27
Joined: 2007-11-16
Posts: 1 |
![]() |
Hello nanodreams, I would like to remove the 'Edit Album' feature in the 'Side Bar' so that the Album User is restricted from editing his Album. Can you tell me what file I need to add your line of code to? You noted the required line of code in your earlier posts (discussions) with 25PSi? Please see below, i.e., $ret = GalleryCoreApi::removeUserPermission($instance->getId(), I was successful editing the ItemAdd.inc , and the ItemAddAlbum.inc files concerning the 'Edit Permissions' and the 'change permissions' modifications. Your code modifications worked perfectly!! Thanks so much for your assistance. Steve nanodreams wrote:
Hello 25PSi |
|
marcap
Joined: 2007-12-06
Posts: 14 |
![]() |
Hello nanodreams, |
|
CoolDreamZ
Joined: 2007-12-21
Posts: 1 |
![]() |
Thanks |
|
Nuckes
Joined: 2008-01-22
Posts: 7 |
![]() |
that works fine Thanks a lot Can i do that also with the move album and move photo permission? |
|
trumpy81
Joined: 2004-12-19
Posts: 15 |
![]() |
GDay All, I added the following to ItemAddAlbum.inc and whenever a user adds an album instead of going to the Edit Album page, he/she gets a security violation message. The album is created and one can add files etc, but there is no option to edit the album either in the dropdown box or the sidebar which is exactly what I wanted. I would simply like to skip the security violation message. Anyone know how I could do that? Added Code (ItemAddAlbum.inc): $ret = GalleryCoreApi::removeUserPermission($instance->getId(), TIA Regards |
|
Pishare
Joined: 2008-12-15
Posts: 25 |
![]() |
<install dir>/modules/core/ItemAdd.inc Hi,in G2 2.3,i can't find the code in the two files. Quote:
$ret = GalleryCoreApi::addUserPermission($instance->getId(),$instance->getOwnerId($'core.all', false); and Quote:
$ret = GalleryCoreApi::addUserPermission($album->getId(), $album->getOwnerId(),'core.all', false); where can find it? |
|
solei
Joined: 2009-02-13
Posts: 2 |
![]() |
I've been banging my head against this for the last 4-5 hours, but I've got a working solution for Gallery 2.3. In file %installdir%/modules/core/ItemAddAlbum.inc: /* Figure out where to redirect upon success */ $redirect['view'] = 'core.ShowItem'; $redirect['itemId'] = $instance->getId(); And add this under it: // Adding these lines to change permissions on album creation. // Get the newly created album's id $TheItemID = $instance->getId(); // Get the ownerid of the newly created album $TheUserID = $instance->getOwnerId(); // Remove the "All Access" permission from the owner GalleryCoreApi::removeUserPermission($TheItemID, $TheUserID, 'core.all'); // Don't forget to remove any permissions from the owner's groups! // (this one specifically denies new albums in this album for group '49') GalleryCoreApi::removeUserPermission($TheItemID, '49', 'core.addAlbumItem'); // Add the permissions you want the user to have! // Allow the user to delete this album GalleryCoreApi::addUserPermission($TheItemID, $TheUserID, 'core.delete'); // Allow the user to add items to this album GalleryCoreApi::addUserPermission($TheItemID, $TheUserID, 'core.addDataItem'); Once you've done this, you'll need to change the code directly below it: if (empty($ret)) { $redirect['view'] = 'core.ItemAdmin'; $redirect['subView'] = 'core.ItemEdit'; $redirect['editPlugin'] = 'ItemEditItem'; } Replace it with this: if (empty($ret)) { $redirect['view'] = 'core.ShowItem'; $redirect['itemId'] = $instance->getId(); // Commenting these out, since after changing permissions, // the owner doesn't have access to the edit page these // forward you to. D: // $redirect['view'] = 'core.ItemAdmin'; // $redirect['subView'] = 'core.ItemEdit'; // $redirect['editPlugin'] = 'ItemEditItem'; } Good luck everyone! |
|
smilem
Joined: 2009-02-25
Posts: 118 |
![]() |
Hi, just tried this on gallery-2.3-typical-en. My file ItemAddAlbum.inc has different lines in it: /* Figure out where to redirect upon success */ Trie to make it like above but "edit permissions" link is still there in album, in photos on left side bar. |
|
solei
Joined: 2009-02-13
Posts: 2 |
![]() |
smilem wrote:
Hi, just tried this on gallery-2.3-typical-en. You have the lines there. First edit /* Figure out where to redirect upon success */ $redirect['itemId'] = $instance->getId(); $ret = GalleryCoreApi::assertHasItemPermission($instance->getId(), 'core.edit'); Second edit: if (empty($ret)) { $redirect['view'] = 'core.ItemAdmin'; $redirect['subView'] = 'core.ItemEdit'; $redirect['editPlugin'] = 'ItemEditAlbum'; } Keep in mind, this will only apply permissions to items created after you've made the mod- you have to manually set permissions on all other items and galleries. |
|
smilem
Joined: 2009-02-25
Posts: 118 |
![]() |
How do I make the selection: "Add photo to Cart" To appear under albums too? I would like that it would be possible to add entire album to cart. I have checked the "Treat Albums as collections of contained images?" checkbox And I think this is because I use this modification that users can't see another user galleries. I use Checkout module 0.4.3 see my thread here http://gallery.menalto.com/node/91975 |
|
drjay
Joined: 2010-05-10
Posts: 1 |
![]() |
Bit of an old one, but I couldn't find a clear answer to this anywhere. I was looking for a way to remove the 'edit permissions' section for all new members using the user albums plugin. bharat on the IRC channel was gracious enough to help. So here's the simple fix for 2.3.1: Edit /modules/useralbum/classes/UserAlbumHelper.class Quote:
/* Make sure the album owner has core.all permissions */ Add just under it: Quote:
GalleryCoreApi::removeUserPermission($albumId, $user->getId(), 'core.changePermissions'); |
|