Using deprecated Profile or UserManager service in 5.6.1? | Adobe Higher Education
Skip to main content
SamTeeeee
October 16, 2015
해결됨

Using deprecated Profile or UserManager service in 5.6.1?

  • October 16, 2015
  • 2 답변들
  • 780 조회

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

이 주제는 답변이 닫혔습니다.
최고의 답변: 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 답변

JustinEd3Adobe Employee답변
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.