Unlocking a page with system user | Community
Skip to main content
Level 2
February 8, 2019
Solved

Unlocking a page with system user

  • February 8, 2019
  • 25 replies
  • 11395 views

Hi,

While coding a WorkflowProcess implementation, I need to create a "system user" who can unlock pages.

Pages are locked through a WorkflowSession on a previous workflow step.

How can I give the "system user" the permissions to unlock pages?

Obviously I don't what to use an admin session, and I'm wondering how can I grant unlock permissions in AEM Security Permissions tab!

Thank you,

Lir

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 Gaurav-Behl

I'd read a thread somewhere which I'll try to find again & post here. It mentioned that 'page.canUnlock()' won't work but 'page.unlock()' will.

25 replies

Gaurav-Behl
Gaurav-BehlAccepted solution
Level 10
February 14, 2019

I'd read a thread somewhere which I'll try to find again & post here. It mentioned that 'page.canUnlock()' won't work but 'page.unlock()' will.

lirAuthor
Level 2
February 14, 2019

Interesting!, I'll try that and let you know

lirAuthor
Level 2
February 14, 2019

That was it!

It works now with admin AND with the system user for which I set "jcr:all"

I will reduce the privileges to only what's required of unlocking and that would be it.

It is strange why page.canUnlock() would return false, but no harm now that I know.

Thank you

Level 2
March 29, 2021
HI @lir, we have a custom 'lock payload' and 'unlock payload' steps in our workflow. But the unlock step fails with "LockException: Not an owner of the lock" although i'm using the same serviceUser to lock and unlock the session and this user has jcr:all on the content path and on /home/groups. I've tried both LockManager API and Page API. And i've tried both wfSession (wfSession.adaptTo(Session.class)) and a serviceUser session (serviceResolver.adaptTo(Session.class)).
Gaurav-Behl
Level 10
February 14, 2019

Finally!!

Its probably because the second user who is trying to unlock doesn't have the read permissions on /home/users/..  path to read it's own ACL to find out that can it unlock that specific /content path?

lirAuthor
Level 2
February 14, 2019

That might be the case for my system user, but it shouldn't happen for admin. It does though