Unable to unlock a page with system user using workflow in AEM 6.5 | Community
Skip to main content
Level 2
July 16, 2020
Solved

Unable to unlock a page with system user using workflow in AEM 6.5

  • July 16, 2020
  • 4 replies
  • 2990 views

Hello,

Is there a way to unlock a page using workflow ?

Steps followed:

1) Content editor will lock the page manually.

2) Start the workflow and before ending the workflow, there is unlock process step to unlock the page.

3) Page unlock would be done by system user.

4) I see error at page.unlock() . The error is 

com.day.cq.wcm.api.WCMException: Unable to unlock page. msg:::Unable to unlock page

Tried giving permissions like jcr:lockmanagement, jcr:all to that specific page from crx but no use.

Please suggest a way to make this possible.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by leoberliant

A page can be unlocked only by a lock owner or a super admin.

https://docs.adobe.com/content/help/en/experience-manager-65/authoring/authoring/editing-content.html

4 replies

leoberliantAdobe EmployeeAccepted solution
Adobe Employee
July 16, 2020
Nupur_Jain
Adobe Employee
Adobe Employee
July 16, 2020

Hi @nandini559 

 

Please take reference from post https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/unlocking-a-page-with-system-user/qaq-p/312926. This post had the similar issues as yours.

 

I went through the solutions and at the end it was concluded that "confirmed that a "system user" cannot unlock a page unless he owns the lock, no matter the permissions I give to him". At the end developer ended up chanding his flow to achive the same which is 

 

1- an AEM user initiates my custom workflow on a page

2- my WorkflowProcess implementation code, locks the page under the initiator session. This means that the initiator owns the lock of that page.

3- on a further down workflow step, my code needs to unlock the page, but the AEM user completing the step is not the same user as the one who owns the lock.

 

Therefore I have to manually (not programmatically) already have created a system user with permissions to unlock ANY page, AND have my code unlock the page under his session.

 

Go through the post and it should lead you to the solution. 

 

Hope it helps,

Nupur

Level 2
July 21, 2020
Thanks for your replies. The only solution i found to unlock the pages using system user is, he should own the lock.
Level 2
March 29, 2021
Hi @nandini559, did you have any luck with this? We have custom 'lock payload' and 'unlock payload' steps in our workflow. But the unlock step fails with "LockException: Not an owner of the lock". I've tried both LockManager API and Page API (LockManager.lock(), Page.lock()). And i've tried both wfSession (wfSession.adaptTo(Session.class)) and a serviceUser session (serviceResolver.adaptTo(Session.class)). And the user has jcr:all on the content path and on /home/groups. @nupur_jain i've followed that post, but had no luck. Any tips?
Level 2
March 29, 2021
Fixed: I was using session.getWorkspace().getLockManager() where session here was serviceUser session instead of wfSession. i.e. final LockManager lockManager = session.getWorkspace().getLockManager(); Here the session should ofcourse be wfSession.