Alfresco 禁止所有用户删除内容

发布于 2024-12-28 05:36:44 字数 759 浏览 4 评论 0原文

我有下一个任务 - 禁止所有用户(管理员除外)删除 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

帅的被狗咬 2025-01-04 05:36:44

难道您不能只更改 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.

痴梦一场 2025-01-04 05:36:44

好的第二个答案:

创建一个实现 NodeServicePolicies.BeforeDeleteNodePolicy 的行为。

每次用户尝试删除项目之前都会触发此行为。
那么你将有一个 NodeRef,从那里你可以检查它是哪个节点以及是否要使其可删除。

执行此操作的最佳方法是:

  • 广告自定义方面并使用行为对其进行评估
  • 或定义自定义节点类型,该类型具有自定义元数据布尔值或由 javascript 或触发 javascript 的规则设置的内容。并隐藏该字段,这样没有用户可以选中/取消选中它

顺便检查一下这个 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:

  • Ad a custom aspect and evaluate it with the behavior
  • Or define a custom node type, which has a custom metadata boolean or something which is set by a javascript or a rule which triggers the javascript. And make that field hidden, so no user can check/uncheck it

Btw check this PDF by Jeff Pots on creating behaviors :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文