如何授予 Sitecore 内容编辑归档项目的权限,但阻止他们删除这些项目

How can I give Sitecore content editors permission to archive items but prevent them from deleting these items

我正在寻找一种方法,允许内容编辑者归档某些类型的项目,同时防止他们删除这些相同的项目。

我已将自定义事件处理程序添加到 item:deleting 事件。由于归档和删除都会触发此事件,因此我想向处理程序添加一些代码,以检查用户是在删除还是归档该项目。如果用户正在删除项目,删除操作将被取消。

有什么办法可以做到吗?

1) item:deleting 事件无法实现

2) 考虑根据角色禁用或删除内容编辑器的 delete 选项。

John West 来自 his Blog 的详细信息:

...Typically, you can do this by overriding the QueryState() method of the command. I think your QueryState would override the default to call that default. If that result is visible/enabled but your logic says that it should not be, then return disabled (to avoid a jittery UI, it's better to disable than hide commands). This has more detail about custom access rights (which could actually apply in your case), but some detail about QueryState: http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2013/02/allow-users-to-unlock-items-locked-to-others-in-the-sitecore-aspnet-cms.aspx Unless they invoke the same commands, you may need to consider other ways to trigger those actions, such as from within the Experience Editor (may require overriding another QueryState or two) and possibly elsewhere.