I have next task – prohibit all users(except admin) to delete a content in Alfresco. 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.
Can’t you just change the
permissionDefinitions.xmland remove the delete permission for every role?There is a separate role for admin, just leave that as it is.
UPDATE:
If you just want to do it for just one folder, then you can set the permissions manually. Un-check inherit permission and set the the groups & user to editor rights. Only coordinator has delete rights, see page
Docs
In case you want to remove the permission of the owner, which still has delete rights. just create a Javascript which removes the owner.