cancel
Showing results for 
Search instead for 
Did you mean: 

Prohibit all users to delete a content

vladislavlysov
Champ in-the-making
Champ in-the-making
Hello!
   I have next task - prohibit  all users(except admin) to delete a content. I'm use a permission service for that, but it doesn't work:

private void setReadOnly(ScriptNode node) {
        permissionService.deletePermissions(node.getNodeRef());
        permissionService.setPermission(node.getNodeRef(), PermissionService.ALL_AUTHORITIES, PermissionService.CONSUMER,
                                        true);
    }
But if i'm add my user if other group(for example - Template designer) and than add new permission for blocking content from Alfresco Share(for example group-"TEMPLATE_DESIGNER" role-"COORDINATOR") - after that my user must delete content, add new content(if it folder) and other…
Another way to solve my problem -

private void setReadOnly(ScriptNode node) {
        permissionService.deletePermissions(node.getNodeRef());
        permissionService.setInheritParentPermissions(node.getNodeRef(), false);
    }
but it is not suitable for some reason. Please, answer - how to prohibit delete a content for all users(except admin)?
Thank you.
2 REPLIES 2

amandaluniz_z
Champ on-the-rise
Champ on-the-rise
As you said, you have to remove permissions from the node, set the "inherit permissions" to false and then set the permissions again.

Why do you say it's not suitable? Any problems?

vladislavlysov
Champ in-the-making
Champ in-the-making
Yes, because lucene search doesn't work from javascript, and i need to dancing arround the chear(run javascript code from java code as administrator - it work, but it not good).