cancel
Showing results for 
Search instead for 
Did you mean: 

Disable inheritance of user permissions

kosist
Champ in-the-making
Champ in-the-making
Dear all!

Similar topics were on this forum, and I've checked all of them. But I don't have experience with scripting, or something; so I would like to ask someone, please, to explain me how to disable inheritance of user permissions for the folders. B/c we're gonna have hundreds of folders, quite tricky folder structure (which we have at the moment, and we will not change it, it doesn't make sense for us). And disable inheritance of user permission for all folders will be something terrible.
So, please - can someone explain, or give script example of how to do it? Some simple, but effective solution? B/c I'm very sure, that many of Alfresco users faced such problem; so I'm interested, how did they manage to solve them.
Thank you very much!
2 REPLIES 2

mitpatoliya
Star Collaborator
Star Collaborator
You can use this ScriptNode API
void setInheritsPermissions(boolean inherit)
to disable inhariting of permission.

Create script with this API something like this.

document.setInheritsPermissions(false);

Then upload script in alfresco
Create rule on root folder to execute script on nodeupdate.
Apply rule to existing folder.

kosist
Champ in-the-making
Champ in-the-making
Thanks a lot; it's exactly, what I was needed!
Below is description, how to do it (for those, who is still struggling).
How to disable user permission inheritance automatically (via Share interface)
I.   Create script.
1.   Login as admin.
2.   Navigate to: Repository -> Data Dictionary -> Scripts.
3.   Press “Create…”
4.   Select “Plain text”.
5.   Enter name, like: disable.permission.inheritance.automatically.js (extension *js is required).
6.   Script body is the following:
document.setInheritsPermissions(false)
7.   Press button “Create”.

II.   Create folder rule.
1.   Go to folder, in which you want to disable permission inheritance.
2.   Select it, and on right side of the screen, in the drop-down list, select More -> Manage Rules.
3.   Click “Create Rules” link.
4.   Enter rule name.
5.   Fill “Define Rule” like:
6.   “When:” -> “Items are created or enter this folder”.
7.   “Perform Action:” -> “Execute script” -> name of created script.
8.   Select checkbox “Rule applies to subfolders”.
9.   Press button “Create”.
10.   In opened window, press button “Run Rules” -> “Run rules for this folder and its subfolders”.