如何自定义发布操作 - sitecore [英] how to customize publish action - sitecore
问题描述
我在 sitecore 中创建了一个用户,为他分配了 2 个角色,即作者和出版商当这个既是作者又是出版商的用户创建任何内容时,他不应该能够发布它.
I created a user in sitecore with 2 roles assigned to him i.e author and publisher When this user who is both author and publisher creates any content he shouldn't be able to publish it.
我可以覆盖发布操作吗?检查提交内容的用户和他被分配的角色,并用弹出消息或类似的东西限制他?任何帮助表示赞赏.
Can i overwrite the publish action? check on the user who submitted the content and the roles he is assigned to and restrict him with a popup message or something like that? Any help is appreciated.
谢谢.
推荐答案
按照以下步骤编写自定义发布操作
Follow the below steps to write custom publish actions
- 为了自定义发布动作,编写一个c#类并继承Sitecore.Shell.Applications.Dialogs.Publish.PublishForm.There是覆盖方法,如 ActivePageChanged 和 OnNext.你可以基本上覆盖这些类并编写自己的警报Sitecore.Web.UI.Sheer.SheerResponse 如下所示.
SheerResponse.Alert("当前项目不会被发布.请选择暂存和 Web 数据库以发布 HOME 项目."); - 从(您的siteroot/)/sitecore\shell\Applications\Dialogs\Publish.
- 在网站根目录中创建sitecore\shell\Override\Applications\Dialogs\publish"
- 将 publish.xml 粘贴到站点根目录下的以下文件夹中sitecore\shell\Override\Applications\Dialogs\publish"
打开publish.xml文件并修改Wizard标签
- For customizing the publish action, Write a c# class and inherit
Sitecore.Shell.Applications.Dialogs.Publish.PublishForm.There
are override methods like ActivePageChanged and OnNext. You can
basically overwrite those classes and write your own alerts with
Sitecore.Web.UI.Sheer.SheerResponse like shown below.
SheerResponse.Alert("The current item will not be published.Please select both staging and web database to publish the HOME item."); - Copy the Publish.xml file from (your siteroot/)/sitecore\shell\Applications\Dialogs\Publish.
- Create "sitecore\shell\Override\Applications\Dialogs\publish" in root of website
- Paste publish.xml in the following folder in root of your site "sitecore\shell\Override\Applications\Dialogs\publish"
Open publish.xml file and modify the Wizard tag
CodeBeside="Sitecore.Shell.Applications.Dialogs.Publish.PublishForm,Sitecore.Cli进入"
CodeBeside="Sitecore.Shell.Applications.Dialogs.Publish.PublishForm,Sitecore.Cli ent"
到
CodeBeside="您的类名和名称空间,您的程序集名称"
CodeBeside="your Class Name with name space here,your Assembly name"
这是publishoverride 表单的屏幕截图
Here is screenshot of how publishoverride form should look like
这篇关于如何自定义发布操作 - sitecore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!