Security - Restricting change of folder permissions to admin (advanced settings parameter?)

EricBastin

Joined: 2010-09-14
Posts: 11
Posted: Mon, 2011-10-03 07:59

Hello,

I often create photo galleries for groups of people who want to share pictures within their group, i.e. not accessible to anyone else. I usually create a gallery for them and create folders for all the members of the groups who want to add pictures. The other members get a generic user/pwd.

In order to avoid questions and security issues, I want to restrict the access to the edition of folder permissions to the admin user only. I could do it in the top menu by adding a test in gallery_event.php that can be found in modules\gallery\helpers\ (got that trick somewhere on the web).

code snippet:
if ($item->is_album()) {
if ($can_edit) {
if (identity::active_user()->admin) { /* prevents non-admin to change folder privileges. */
$options_menu->append(Menu::factory("dialog")
->id("edit_permissions")
->label(t("Edit permissions"))
->url(url::site("permissions/browse/$item->id"))); }
}

However, I could not find how to change this in the pop-up menu of the folder's Thumbnail view (any advice here would be welcome).

In any case, this means changing the code for each install, which is not very practical. Also, I believe that I am not the only one with this issue. Could we improve this with a parameter in the "Advanced Settings" that would restrict the change of permissions to admin users only?

I realize that this is not a critical issue, but if it is easy to implement, it would certainly make life easier for some people (including me).

Thanks a lot for this great product.

Eric

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25968
Posted: Mon, 2011-10-10 07:51

Here is a module to test as I did not do extensive testing.
It removes the two 'edit permissions' links except if you are the admin.
I'm sure somebody can come up with a better name so that it reflects what it does.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

AttachmentSize
admin_permissions.zip3.11 KB
 
EricBastin

Joined: 2010-09-14
Posts: 11
Posted: Thu, 2011-10-13 08:10

Hello Floridave,

I just tried the module and it works exactly the way I need it. :-) Thanks a lot. I will put it on my two galleries and let you know if there is any problem. Thanks again.

Eric

 
emma009

Joined: 2012-03-01
Posts: 11
Posted: Sat, 2012-03-10 07:25

Eric.

Please i just uploaded this gallery for the first time...i am having a problem i believe u can solve....i actually want users to be able to upload photos when they log in....becos i cannot find the upload menu when i log in through user account...please help

emma

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25968
Posted: Sat, 2012-03-10 19:59

Is your question related to this thread or this module?

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
emma009

Joined: 2012-03-01
Posts: 11
Posted: Thu, 2012-05-03 09:52

my question is related to this treat...please dave...when i first installed the admin permission module it worked perfectly well...but recently i discover that when i click the album permission menu...it opens but does not display options...it just display the album name and there are no options under..

please help.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25968
Posted: Thu, 2012-05-03 13:22

Don't know from your explanation. Uninstall the module?

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
emma009

Joined: 2012-03-01
Posts: 11
Posted: Thu, 2012-05-03 15:47

I HAVE UNINSTALLED THE MODULE AND REINSTALL....BUT STILL NOT SHOWING THE OPTIONS

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25968
Posted: Thu, 2012-05-03 16:35

Sorry to hear that it does not work for you.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25968
Posted: Thu, 2012-05-03 16:46

 
emma009

Joined: 2012-03-01
Posts: 11
Posted: Thu, 2012-05-03 16:49

anyway...thank you so much...

please do you know any module that i can use to diplay some little images at the bottom of my site? just to display any image i want randomly..??

 
holyHop

Joined: 2012-05-21
Posts: 1
Posted: Thu, 2012-05-24 13:58

Hi,
I just wanna share something: users can access to the permissions throw link (index.php/permissions/browse/<id>), that mean everybody who have edit rights can see who can access to the album...
So i added two lines in 2files in module/gallery/views folder: permissions_browse.html.php and permissions_form.html.php.

Quote:
<?php
if (!identity::active_user()->admin)
die(t('Only Administrator can change permissions.')); ?>

That's probably not the best solution, but it's one...

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25968
Posted: Sun, 2012-09-16 21:25

Because of incompatibility with another module this module is now replaced with:
http://codex.gallery2.org/Gallery3:Modules:remove_actions

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team