Alfresco 禁止所有用户删除内容
我有下一个任务 - 禁止所有用户(管理员除外)删除 Alfresco 中的内容。我为此使用权限服务,但它不起作用:
private void setReadOnly(ScriptNode node) {
permissionService.deletePermissions(node.getNodeRef());
permissionService.setPermission(node.getNodeRef(),
PermissionService.ALL_AUTHORITIES, PermissionService.CONSUMER, true);
}
但是如果我添加我的用户(如果其他组(例如 - 模板设计者)),然后添加新的权限以阻止来自 Alfresco Share 的内容(例如组-“TEMPLATE_DESIGNER”角色-“COORDINATOR”) - 之后我的用户必须删除内容,添加新内容(如果是文件夹)和其他... 解决我的问题的另一种方法 -
private void setReadOnly(ScriptNode node) {
permissionService.deletePermissions(node.getNodeRef());
permissionService.setInheritParentPermissions(node.getNodeRef(), false);
}
但由于某种原因它不适合。请回答-如何禁止所有用户(管理员除外)删除内容? 谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
难道您不能只更改
permissionDefinitions.xml
并删除每个角色的删除权限吗?管理员有一个单独的角色,保持原样即可。
更新:
如果您只想对一个文件夹执行此操作,则可以手动设置权限。取消选中继承权限并设置组和权限。用户到编辑者的权限。只有协调员有删除权限,参见页面
文档
如果您想删除所有者的权限,该所有者仍然具有删除权限。只需创建一个 Javascript 来删除所有者。
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.
好的第二个答案:
创建一个实现 NodeServicePolicies.BeforeDeleteNodePolicy 的行为。
每次用户尝试删除项目之前都会触发此行为。
那么你将有一个 NodeRef,从那里你可以检查它是哪个节点以及是否要使其可删除。
执行此操作的最佳方法是:
顺便检查一下这个 Jeff Pots 的关于创建行为的 PDF :)
OK Second Answer:
Create a behavior which implements NodeServicePolicies.BeforeDeleteNodePolicy.
This behavior will get triggered every time before a user tries to delete an item.
So Then you'll have a NodeRef, from there you can check which node it is and if you want to make it deletable or not.
The best way to do this is to:
Btw check this PDF by Jeff Pots on creating behaviors :)