Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Obtaining session apart from repository.loginAdministrative(null) way.

Avatar

Level 9

Hi All,

repository.loginAdministrative(null) is a deprecated method of obtaining a session instance. What would be an alternative that can be used here.

Any thoughts/pointers here, will be helpful.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

You should use Sling service resource resolver for getting session in
backend services. This is now recommended for getting sessions as  it
restricts the access to the service code only on the required repository
paths unlike loginAdministrative which exposes full permissions to your
services. You can follow the below example-
https://helpx.adobe.com/experience-manager/using/querying-experience-manager-sling.html
 

View solution in original post

4 Replies

Avatar

Correct answer by
Employee Advisor

You should use Sling service resource resolver for getting session in
backend services. This is now recommended for getting sessions as  it
restricts the access to the service code only on the required repository
paths unlike loginAdministrative which exposes full permissions to your
services. You can follow the below example-
https://helpx.adobe.com/experience-manager/using/querying-experience-manager-sling.html
 

Avatar

Level 9

Hi Kunal/Praveen,

Thank you for your replies.

Avatar

Employee

I need to unlock a page through code which is locked by another user. 

Do i need to create a service user similar to admin user which can be used to impersonate and unlock resources? How can this be achieved?