Enable 'Unlock Document' for Non-Admin Users
Introduction
Goal
Enable users without administrator privileges to unlock locked documents.
Background
When a user opens a document for editing in the CMS, that document is locked to all other users until the editing user closes the document. This prevents editing conflicts but a forgetful user may leave a document in editing mode longer than necessary, effectively locking other users out of the document. Normally only administrators can explicitly unlock locked documents, but it is possible to enable users without administrator privileges to unlock documents too.
Configuration
There are different ways in which administrators can enable the Unlock document facility for non-admin users:
Enable 'unlock' for all users with a specific privilege
To give all users with editor privileges the ability to unlock documents:
-
Open the Console.
-
Login as admin.
-
Browse to the node:
/hippo:configuration/hippo:modules/scxmlregistry/hippo:moduleconfig/hipposcxml:definitions/documentworkflow
-
Edit/change the hipposcxml:source property which contains the SCXML document content for the document workflow. Find and update the two if statements that check if the current user is allowed to use (and even see) the administrative Unlock document facility.
The default SCXML document contains these two if statement blocks:<if cond="!editor and workflowContext.isGranted(draft,'hippo:admin')"> <!-- For an admin (granted hippo:admin) enable the unlock operation if not-current editor --> <hippo:action action="unlock" enabledExpr="true"/> </if>
and:<if cond="workflowContext.isGranted(draft,'hippo:admin')"> <!-- for an admin (granted hippo:admin) report the unlock operation as available but disabled --> <hippo:action action="unlock" enabledExpr="false"/> </if>
Change the conditions in both if statements into workflowContext.isGranted(draft,'hippo:editor'):
<if cond="!editor and workflowContext.isGranted(draft,'hippo:editor')"> <!-- For an admin (granted hippo:admin) enable the unlock operation if not-current editor --> <hippo:action action="unlock" enabledExpr="true"/> </if>
and:<if cond="workflowContext.isGranted(draft,'hippo:editor')"> <!-- for an admin (granted hippo:admin) report the unlock operation as available but disabled --> <hippo:action action="unlock" enabledExpr="false"/> </if>
-
Save your changes.
-
Now users with editor privileges have the Unlock document facility enabled for them.
Enable 'unlock' for specific users
To give the editor and admin users the ability to unlock documents:
-
Open the Console.
-
Login as admin.
-
Browse to the node:
/hippo:configuration/hippo:roles
-
Create a new child node and give it a proper descriptive name, for example unlocker.
-
Add a new hipposys:privileges property to the new unlocker node and set the value to a proper value, for example hippo:unlocker:
/hippo:configuration: /hippo:roles: /unlocker: hipposys:privileges: hippo:unlocker
-
Browse to the node:
/hippo:configuration/hippo:groups
-
Create a new node and give it a proper name, we recommend to give it the same name as the new role you just created, e.g. unlocker.
/hippo:configuration: /hippo:groups: /unlocker:
-
On this node, add a new hipposys:members property and add these two values, which are the users we want to give the ability to unlock documents:
admin
editor+ hippo:configuration + hippo:groups + unlocker - hipposys:members = {admin, editor}
-
Now you need to update any domain rules that need to take that into account which checking access for different parts of the repository, like document etc...
/hippo:configuration/hippo:domains/hippodocuments
and add a new node of type hippo:authrole for example named unlockauthrole:
-
Add hipposys:groups property with value unlocker
-
Add hipposys:role property with value unlocker
/hippo:configuration: /hippo:domains: /hippodocuments: /unlockauthrole: hipposys:groups: unlocker hipposys:role: unlocker
-
-
Find the SCXML document worklow definition, as described above and update the two (2) if statement conditions to check workflowContext.isGranted(draft,'hippo:unlocker') instead:
<if cond="!editor and workflowContext.isGranted(draft,'hippo:unlocker')"> <!-- For an admin (granted hippo:admin) enable the unlock operation if not-current editor --> <hippo:action action="unlock" enabledExpr="true"/> </if>
and:<if cond="workflowContext.isGranted(draft,'hippo:unlocker')"> <!-- for an admin (granted hippo:admin) report the unlock operation as available but disabled --> <hippo:action action="unlock" enabledExpr="false"/> </if>
-
Save your changes.
-
Now users from the unlocker group have the Unlock facility enabled for them.