Using deprecated Profile or UserManager service in 5.6.1? | Community
Skip to main content
SamTeeeee
October 16, 2015
Solved

Using deprecated Profile or UserManager service in 5.6.1?

  • October 16, 2015
  • 2 replies
  • 780 views

Hi guys,

I am using the Profile service and the UserManager factory, both of which have stopped working in the publisher in 5.6.1.

Is there an alternative, or solution which will allow me to continue using it?

My code below:

public IGProfile getUserProfile(String authorizableId) { if (!StringUtils.isEmpty(authorizableId)) { try { /** * Do not close the resolver in this case as IGProfile needs to read the props from the * SessionAndResolver, normally we need to close the SessionAndResolver. */ final SessionAndResolver sessionAndResolver = rmanager.getCurrentOrCreateNew(); final ResourceResolver resolver = sessionAndResolver.getResolver(); final Authorizable auth = userManagerFactory.createUserManager(sessionAndResolver.getSession()).get(authorizableId); final Resource profileResource = resolver.getResource(auth.getHomePath() + "/profile"); if (profileResource != null) { return profileResource.adaptTo(IGProfile.class); } } catch (NoSuchAuthorizableException e) { LOG.info("No such user '{}'", authorizableId); // No Authorizable for that ID exists so return null } catch (AccessDeniedException e) { LOG.warn("AccessDeniedExceptionto load user '{}'", authorizableId, e); } } return null; }

Thanks!

Sam

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 JustinEd3

Hi Sam,

I don't see any usage of the CQ Profile class. All I see is "IGProfile".

Regarding the UserManagerFactory, as documented, you should use the Jackrabbit UserManager instead of the CQ UserManager (https://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/security/UserManager.html). The easiest way to get a Jackrabbit UserManager based on the code above would be to write

UserManager userManager = resolver.adaptTo(UserManager.class);

Regards,

Justin

2 replies

JustinEd3Adobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

Hi Sam,

I don't see any usage of the CQ Profile class. All I see is "IGProfile".

Regarding the UserManagerFactory, as documented, you should use the Jackrabbit UserManager instead of the CQ UserManager (https://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/security/UserManager.html). The easiest way to get a Jackrabbit UserManager based on the code above would be to write

UserManager userManager = resolver.adaptTo(UserManager.class);

Regards,

Justin

smacdonald2008
Level 10
October 16, 2015

To follow up with what Justin stated -- you can read a community article that talks about how to use the Jackrabbit User Manager from an OSGi bundle:

http://helpx.adobe.com/experience-manager/using/developing-aem-osgi-bundles-jackrabbit.html

Hope this helps.