Restricting permissions

The Beekeeper

Joined: 2012-11-21
Posts: 8
Posted: Wed, 2012-11-21 21:54

Hello,
newbie to using Gallery3.

I'll briefly outline my requirements. It'll save time.

I've set up a gallery for a small group of people to upload pictures to. A shared photo album.
It's a single album.
What I want to do is have the settings so that people can't rearrange the album, they can't change album description/title, they can't delete photos or rotate them. But they can edit photos so that people can provide descriptions of the pictures they've uploaded. May appear restrictive but I'm dealing with a group of people who are not exactly confident when it comes to anything to do with computers, nevermind websites! And I don't intend to keep uploading pictures for other people, better things to do.

I've been scratching my head going through the code and all the modules available. Unfortunately I'm just going around in circles now.

Any ideas of how or if this can be achieved?

Any feedback much appreciated.

Kind regards

Nick

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Fri, 2012-11-23 14:08

Closest starting point I know of: http://codex.gallery2.org/Gallery3:Modules:remove_actions

I don't really even understand what you're looking to accomplish. If they "can't change album description/title" how can they "can edit photos so that people can provide descriptions of the pictures they've uploaded"? Honestly though, even if you explain it, I can't really give much more guidance than offering the starting point linked above.

 
The Beekeeper

Joined: 2012-11-21
Posts: 8
Posted: Fri, 2012-11-23 22:20

Thank you tempg.
I'm already editing the Module:remove_actions and have achieved 80% of what is needed.
A little more coding and I should get what's required.

Thanks.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sat, 2012-11-24 02:32

Let me know what specific action you removed so I can update the module for others to benefit as well.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
The Beekeeper

Joined: 2012-11-21
Posts: 8
Posted: Mon, 2012-11-26 16:27

Hi Dave,
I've edited the "remove_actions" module to my needs. But I've also extended it.
All Album options can be removed.
All Photo options can be removed.
All Add options can be removed.
If all the options in a menu are selected for removal the menu tab is also removed.
i.e. If you remove Add photos and remove Add album from the Add menu then as these are the only options the menu tab Add is also removed.
No point in having a menu tab that doesn't have a menu.

I have not been able to annotate the checkboxes as I wish to indicate to the user how this works.

How do I submit the revised module?

Cheerio

Nick

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2012-11-26 17:30

Post it here and I can review and then I can add it to the code page.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
The Beekeeper

Joined: 2012-11-21
Posts: 8
Posted: Mon, 2012-11-26 17:41

Hi Dave,
as requested.
The only two files I had to work on are
trigger_remove.html.php
admin_remove_actions.php

I feel it is incomplete without a full account of what happens when each group of submenus is selected.
But I don't know how to add text output to admin checkbox form.

Cheerio

Nick

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2012-11-27 02:33

Thanks!
Looks good. I would think about re-factoring it a bi to have the same about of if statements to eliminate more and one or two <scrip> and </script> tags.
Care to do that? A great way to contribute back :-)

I'm not sure what you mean by:

Quote:
I don't know how to add text output to admin checkbox form.

Screen shot or a better explanation?

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
The Beekeeper

Joined: 2012-11-21
Posts: 8
Posted: Tue, 2012-11-27 13:20

Hello Dave,
I'll look at refactoring. But may take me some time, I'm a C programmer on microcontrollers, php can I work with and java is just plain horrible.
A string of IF statements etc is common in my field. Refactoring usually produces too many overheads on micros.

As to the text question I'll explain it better.
The code obviously generates a list of checkboxes for the admin to remove the action.
But there are groups of related actions. i.e. the 'Add' group comprises the 'Add album' and 'Add photos'
When all the actions within a group are selected for removal the code also removes the main menu item. e.g 'Add' as there'e no submenu items to display.
What I want to do is insert some text at the top of the checkboxes for each group to indicate to the administrator what happens when they select all the 'remove actions' within a group.
At the moment they'll just see a main menu item disappear and wonder what the hell is going on!

Cheerio

Nick

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2012-11-27 20:25

I guess I did not explain vary well.....
I think that all the if statements are needed jut only one opening <script> tag and one closing </script> tag are needed. Now it looks like there will be a opening tag and a closing tag for each bit of JS.

Grouping of the checkboxes can be done. I'll take a look at it a bit later today when I get back from my road trip for my real job.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
The Beekeeper

Joined: 2012-11-21
Posts: 8
Posted: Wed, 2012-11-28 19:39

Hello Dave,
there was a big hole in the edited Remove Actions module.
I omitted the options on the thumbnail phtotos. This is because some of the options use a different wording.
I have corrected this.
Again if all the action are removed from the thumbnail 'options' menu I've made the menu disappear.

Cheerio

Nick

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2012-12-02 19:00

Thanks for your contribution!
I have updated the modules codex page to version 2 and refactored it a bit to speed up the JS and have less code.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Dr_Spock

Joined: 2009-02-11
Posts: 5
Posted: Tue, 2012-12-04 14:17

Just the plugin I needed. Thanks a lot. Some feature requests:
- Remove "Delete this album" (not only "Delete photo")
- Remove "Choose as the album cover"

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2012-12-05 03:44

Dr_Spock,
try the version on the codex page. I just added the 2 options but did not test.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2013-01-14 22:59

Perhaps the http://codex.gallery2.org/Gallery3:Modules:tag_by_group module is what you are after.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2013-01-24 23:47

Updated the remove_actions module to add a few more actions that the admin can remove.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Tony Franco

Joined: 2013-03-06
Posts: 53
Posted: Fri, 2013-08-30 02:12

r

 
Tony Franco

Joined: 2013-03-06
Posts: 53
Posted: Fri, 2013-08-30 02:12

Hello Dave,

Thanks by your advice!

This module is very useful!

But the option to Remove the "Edit album" action is not working here...

I need at the cover of album, for the user, just the options: "Add a photo" and "Organize album"... could you help?

Inside album is working Beautiful!!

Thanks and Regards!

Tony

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2013-08-30 04:33
Quote:
But the option to Remove the "Edit album" action is not working here...

Sure it does but the "edit this album" does not. :-)
edit the modules view file adding the bold around line 20

  <? if (module::get_var("remove_actions", "editalbum") == true) : ?>
      $(document).ready(function(){
	    $('li > a:contains("<?= t('Edit album') ?>")').remove();
	    $('li > a:contains("<?= t('Edit this album') ?>")').remove();
      });
  <? endif ?>

hope that works.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team