MasterKey – Unlock Sitecore Items en masse
So pretty exciting news! My first Module has just become available on the Sitecore Marketplace;
It is inspired by the struggles one of the QA guys I work with who had the joy of going through and unlocking folders and folders of items locked by a Content Editor’s account.
It has been built from the ground up for Sitecore 8 but I have developed for backwards compatibility and I have tested as far back as 7.0 but foresee it working without issue in Sitecore 6.
How to Install
Really simple install, download the Module from the Sitecore Marketplace. The module only needs to be installed via the Package Installer from the Sitecore Desktop. Follow the installer instructions and if there are prompts to install Items agree.
The package is lightweight with three new Items added to the Core database and two physical files, the MasterKey.dll residing in the bin and MasterKey.config which installs into the Includes folder within the App_Config directory.
The first feature of the Module is to a new Button in the Review Tab of the Content Editor Ribbon. The button looks at the Item in context and loops through its Child Items to determine if any are locked and can be unlocked by the User in Context at that point in time. If that is the case the button is enabled.
On clicking the button it begins the uiUnlockChildren pipeline defined in the config file. Which completes the checks again before looping through unlocking the item. Once completed a unlock report will be prompted outlining how many were unlocked, how many could not be unlocked and which items can not be unlocked due to permissions.
From unlocking Child Items it make sense give the option to unlock the Item in Context. However after unlocking the Context Item it runs the uiUnlockItemsChildren pipeline to determine if any suitable Child Items are unlockable and if there are to prompt the user to ask if they should also be unlocked.
If Yes the pipeline continues and unlocks the Child Items and produces the same report as above. If the user chooses No, Cancel or exits the pipeline is aborted and no child items are unlocked.
Finally for ease of use the Module includes a new Gutter Item – Unlockable Items. As the name suggests if an Item can be unlocked by the User in Context they will see the Key icon in the Gutter.
Clicking the Icon triggers the same pipeline as the Unlock Item ribbon button; unlocking the Item in context, checking for unlockable children and prompting the User to unlock child items if there are any that can be unlocked.
And that’s it!
The module itself follows the same rules of locking and unlocking items in Sitecore; account hierarchy – Content Editors being unable to unlock locked Items by the Administrator, unlocking while editing – correctly handles the changes made etc.
Thinking about future versions of the Module will be largely based on feedback as well as providing features to search for Items locked by users and the ability to unlock one, many or all. I imagine this will be build on SPEAK so will be an issue for backwards compatibility.
The code can be found on GitHub on the link below but I’ll post a blog about the architecture and design principles that work well for building Sitecore Shared Source Modules.