Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alfresco Prohibit all users to delete a content

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.

like image 959
VladislavLysov Avatar asked Oct 08 '22 22:10

VladislavLysov


1 Answers

Can't you just change the permissionDefinitions.xml and 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.

like image 67
Tahir Malik Avatar answered Oct 12 '22 12:10

Tahir Malik