Using deprecated Profile or UserManager service in 5.6.1?
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