Preventing editors approving their own content using Episerver approval sequences

Tags: Episerver 10 Oct 06, 2017

Episerver approval sequences are a great way of controlling how editors get their content signed off by visually defining a set of approval steps that content must go through before it’s considered approved. In organisations that have compliance requirements a common requirement is that editors should not be able to publish their own content. This has already been covered here: Adding custom logic to your publishing step.

The approach above does not prevent users from approving their own content as part of an Episerver approval sequence as approval sequences didn’t exist at the time the blog was written. Fortunately there are some approaches that can help.

Approach 1 - Prevent an approval sequence from being started

Editors are now prevented from starting an approval when they are defined as approver anywhere in the approval sequence:

Approach 2 - Prevent users approving a step when the approval sequence has started

Another more extreme approach is to use inteceptors on the standard IApprovalEngine implementation. This throws an exception if an approval sequence has been started and a user tries to approve a step if they are one of the available approvers:

This approach does prevent a user approving thier own steps though the user experience isn't exactly good... 

Conclusion

This is just a quick post to share a simple solutions that uses just a couple of lines of code. Hope you find them useful!

comments powered by Disqus