How to provide Sitecore non-administrator user the capability to unlock items locked by idle users?
Due to its capability to configure different features and functionalities, Sitecore always seems like a jig-saw puzzle to me. Recently, one of the scenarios I came across was - content editors locked content items and didn't unlock the items after edit, the concerned manager wanted overriding permissions to unlock items. This seemed like a common scenario across the world. With this context, it is probably well-known that Sitecore administrators have the capability to view locked items and unlock items but it wouldn't be judicious to give anyone administration capability. In this blog post, I cover the step-by-step process to create a role that can help view the locked items report and unlock items but the user wouldn't be allocated administrator permission directly. In other words, under-the-hood, the user would be toggled as admin only to view/unlock items but then be back to original permissions.
Pre-requisites:
Running Sitecore instance (10.4.0 in my case)
Sitecore PowerShell Extensions (SPE) (6.4 in my case)
Once SPE is installed, no hidden secret that if you are logged-in as administrator, you can view the locked items report from Start menu under Reporting Tools:
User | Role |
---|---|
Tom | Sitecore Client Maintaining |
navan | Sitecore Client Users |
Jon | Sitecore Limited Content Editor |
Since I did not want to touch the existing Locked Items report, I created a separate menu option for the locked item report but this time for non-admin access. Although the script body is the same, I didn't use the same item mainly because the menu options need to work differently for the non-admin's report and I didn't want to disturb the existing admin functionality in the process.
Source | Destination | Template |
---|---|---|
Tools | Non-Admin | PowerShell Script Module Folder |
Security Reports | Security Management | PowerShell Script Module |
Internal | Internal | PowerShell Script Library |
Reports | Reports | PowerShell Script Library |
Most importantly, remember to rename the view name in the script body of the new Locked Item Report item form LockedItems to LockedItemReport:
Now, similar to how other sample reports are configured, add role-based rule for the new items but point the rule to the new view named LockedItemsReport:
Same with the Unlock All and Unlock ribbon items, customise the Edit rules field for the item(s) to work for the new Locked Items Report as follows:
Within the newly copied Unlock All and Unlock items, add the new logic that uses the elevated access just to unlock the item:
Nevertheless, with that setting in place, login as navan, configured with the following roles:
- Sitecore Client Users
- Report User
Comments
Post a Comment