Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turning off "Inherit permissions from higher levels" programmatically

I am trying to setup some group maintained folders that should not be seen by the other groups. Currently, I achieve that by un-clicking the "Inherit permissions from higher levels" check-box in the @@sharing tab, but I would like to automate this.

I could not find anything about this in the documentation or googling. After searching around the eggs directory I found some interesting things about 'ac_inherited_permissions' but nothing jumped out at me as my solution.

I'd like to do something like obj.inherited_permissions = False, or call whichever function I need to.

Any ideas?

like image 644
chasetheskyforever Avatar asked Oct 30 '12 15:10

chasetheskyforever


People also ask

How do I disable inheritance in subfolders?

To remove permission inheritance for the folder, click Stop Inheriting Permissions. For existing users, edit the permissions of those in the current list by selecting the check boxes and clicking either Edit User Permissions or Remove User Permissions.

What happens if I disable inheritance?

If inheritance is disabled at a specific level, the object, either a file or folder will not inherit permissions from its parent folders. If that object is a folder its own “children”, subfolders and files, will still inherit permissions of that folder as long as those child objects themselves have inheritance enabled.


1 Answers

The sharing tab only affects local roles. These usually are inherited from parents (acquired), but you can explicitly block these by setting __ac_local_roles_block__ to True on an object.

Make sure, however, you set this on the unwrapped object (no acquisition context):

from Acquisition import aq_base

aq_base(object).__ac_local_roles_block__ = True
like image 126
Martijn Pieters Avatar answered Oct 17 '22 04:10

Martijn Pieters