To get User Name or User Email,
com.day.cq.security.profile.Profile
can be used. But it is depricated from CQ5.5. What should be the work around?
Use the classes from org.apache.jackrabbit.api.security.user
package. You can access User
via the UserManager
(which you can get by calling adaptTo(UserManager.class)
on a ResourceResolver
). User
supports the getProperty
method, which can be used to get "profile/email"
, "profile/familyName"
, etc.
EDIT
The WorkflowProcess.execute
method has WorkflowSession parameter. To access the UserManager
from a WorkflowSession
, cast its session to a org.apache.jackrabbit.api.JackrabbitSession
, which has a getUserManager()
method:
JackrabbitSession js = (JackrabbitSession)workflowSession.getSession();
UserManager um = js.getUserManager();