[SOLVED] Prevent sub-item permission inheritance

pumaka

Joined: 2007-05-14
Posts: 46
Posted: Fri, 2010-05-14 19:13

I use the gallery for private albums, all password-protected with custom permissions.

I start with:
1. Add a new user
2. Create a custom user album

Here's how I set the permissions:
3. Add "View item" permission for this new user on the root album
4. In the user's custom album I delete all permissions and then add in just the ones I want to grant.

And this is the problem:
In step 3, when I add this user with "View item" permission to the root folder, it also ADDS THIS USER TO EVERY OTHER ALBUM with the same permission. So I have to go into each existing album's permissions and remove the new user.

Unchecking "Apply changes" check box doesn't work, it always stays on.

I'm talking about the check box with this text above it:

Quote:
This item has sub-items. The changes you make here can be applied to just this item, or you can apply them to all sub-items. Note that applying changes to sub-items will merge your change into the existing permissions of the sub-items and may be very time consuming if you have many sub-items. It's more efficient to grant permissions to groups and then add and remove users from groups whenever possible. Changes are applied to sub-items by default.

So my question is - how do I add "View item" permission for new users on the root album only, and NOT on sub-items?

Thanks in advance!

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Fri, 2010-05-14 19:21
Quote:
Unchecking "Apply changes" check box doesn't work, it always stays on.

I always works for me. You need to uncheck that box before making any change change. If the page reloads that checkbox becomes checked again and you'll need to uncheck it again.

I don't know the exact change you'd need to make to the code, but if you want to make sure that's not checked by default. Take a look at:

/modules/core/ItemPermissions.inc
/modules/core/templates/ItemPermissions.tpl

Search for applyToSubItems and dig around in there.

In ItemPermissions.tpl you might just need to change to it's unchecked by default:

  <input type="checkbox" checked="checked"
   name="{g->formVar var="form[applyToSubItems]"}" value="{g->text text="Apply to sub-items"}"/>

____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
pumaka

Joined: 2007-05-14
Posts: 46
Posted: Sat, 2010-05-15 14:02

That worked!! :)) Thank you very much!