Lockmanager | Community
Skip to main content
selvaganesh
Level 5
Nov 27, 2018 5:45 PM UTC
Solved

Lockmanager

I am using lockmanager in code to lock/unlock the page. I am able to lock a page with user session, but when unlocking with user session it always fails (not the owner of lock). Is there anyway to create lock-superuser in aem and use that session to unlock it ?

I referred https://docs.adobe.com/docs/en/spec/jsr170/javadocs/jcr-2.0/javax/jcr/lock/LockManager.html#unlock(java.lang.String)

LockManager (Content Repository for Java Technology API Version 2.0)

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
vipins5188
vipins5188Accepted solution
Level 3
Nov 27, 2018 6:51 PM UTC

System user wont work even though it is part of administrators group. You have to have only admin user session . And that you can get only by slingRepository.loginAdministrative(null);

5 replies

smacdonald2008
Level 10
Nov 27, 2018 9:25 PM UTC

Remember to use slingRepository.loginAdministrative - you must whitelist bundle

Translate
vipins5188
vipins5188Accepted solution
Level 3
Nov 27, 2018 6:51 PM UTC

System user wont work even though it is part of administrators group. You have to have only admin user session . And that you can get only by slingRepository.loginAdministrative(null);

Translate
selvaganesh
Level 5
Nov 27, 2018 6:49 PM UTC

Even admin session failed to unlock. I am getting the session from a system user who is admin.

Translate
vipins5188
Level 3
Nov 27, 2018 6:48 PM UTC

As Arun said in AEM only admin or lock owner can unlock the page.No other user can unlock it.

However there is a way to unlock the page using admin session in AEM

You can use adminSession = slingRepository.loginAdministrative(null); and get admin session and use that to unlock the page. It will wokr ,we are using the same. But this is deprecated api in newer version but still working as expected.

Translate
arunpatidar
New Participant
Nov 27, 2018 6:19 PM UTC
Arun Patidar