Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Lockmanager

Avatar

Level 6

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(j...

LockManager (Content Repository for Java Technology API Version 2.0)

1 Accepted Solution

Avatar

Correct answer by
Level 3

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);

View solution in original post

5 Replies

Avatar

Level 3

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.

Avatar

Level 6

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

Avatar

Correct answer by
Level 3

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);

Avatar

Level 10

Remember to use slingRepository.loginAdministrative - you must whitelist bundle