4 Replies Latest reply on Feb 21, 2013 11:27 AM by ctwplyp

    How can i get email address from userid in cq 5.5

    efish11 Level 1

      How can i get email address from the userid/Authorizable as in CQ 5.5 Profile class is Deprecated

       

      Environment CQ 5.5, Linux

        • 1. Re: How can i get email address from userid in cq 5.5
          hypnotec Adobe Employee

          use com.adobe.granite.security.user.UserProperties instead. e.g.

           

          UserProperties u = resourceResolver.adaptTo(UserProperties.class);

          String email = u.getProperty(UserProperties.EMAIL);

          • 2. Re: How can i get email address from userid in cq 5.5
            ctwplyp

            This answer sends you down a frustrating dead end.  I ended up using node logic to get through this.  The com.adobe.granite.security.user.UserProperties library is not fully implemented and does not allow you to get the user properties.  Instead, you are going to get null pointers when you try to build them. If I am wrong, please send me a fully implemented code usage with UserManager to Authorizable to UserProperties.

            • 3. Re: How can i get email address from userid in cq 5.5
              maruthid Level 1

              If I am not wrong UserManager is deprecated in 5.5.

              Some thing like this you can try

              String userId = adminSession.getUserID();

                                                                                              UserManager userManager = factory.createUserManager(adminSession);

                                                                                              Authorizable user = userManager.get(userId);

                                                                                              userName = user.getName();

              • 4. Re: How can i get email address from userid in cq 5.5
                ctwplyp Level 1

                That is deprecated code.  The whole point was to stop using the deprecated code.