1
votes

We have three states in workflow Draft, Editorial and Final.

Content authors on save of an item goes to Draft State and once they submit it goes to Editorial state and publisher can approve or reject it.

We have Content Authors who should not be able to delete pages (for this I removed delete access for home and all pages under it) in the site but should be able to delete the pages in draft state. Can this be achieved?

I feel that since I removed delete access for home and all pages under it, author is not able to delete his page in draft state as well.

1

1 Answers

1
votes

An options to make a workflow state Delete, with a action to do the delete (I think you need the security disable or user switcher to do that.

But what about, if the author edit an already existing item, maybe you need a delete version instead of item.

using Sitecore.Data.Items;
using Sitecore.Workflows.Simple;

namespace Mirabeau.Sitecore.Workflow.Action
{
    public class DeleteItemAction
    {
        public DeleteItemAction()
        {
        }

        public void Process(WorkflowPipelineArgs args)
        {
            Item item = args.DataItem;
            //example it is not realy save to have this code, every one can delete now. replace or make up with own check
            using (new Sitecore.SecurityModel.SecurityDisabler())
            {
              item.Recycle();
            }
        }
    }
}

Use /sitecore/templates/System/Workflow/Action below the Delete Workflow/Command in the Data section,
"Type string" set the Mirabeau.Sitecore.Workflow.Action, YourDLL

See the "Auto Publish" action in the sample workflow.

An other option is to make a custom or change the Delete Command. Somethings like this Create a Command with dialoge but than with a Delete where you do your specific rights checks.