I am using the below code to create users under /home/users/myproject
Session session = request.getResourceResolver().adaptTo(Session.class);
//Session session2 = request.get
JackrabbitSession jsession= (JackrabbitSession) session;
UserManager usermanager;
final String userName = "testincdscdcg2ss2dcd3";
try {
usermanager = (UserManager) js.getUserManager();
User user = usermanager.createUser("Mytestissng2dcddcdxsx", "dcdMyTestingsvdfcdv2", new Principal() {
public String getName() {
return userName;
}
}, "/home/users/myproject");
jsession.save();
But it is creating users with strange node names, Attached is the screen shot. Even if i create a user from AEM useradmin UI it creates users with similar strange node names.
Just wondering how does geometrixx has user nodes with proper names under /home/users/geometrixx.
Also once the new user node is created under my project path i.e /home/users/myproject/ppXn-NUF084WwcxjAD9 i need to add a profile node and add some properties using below code
String NodePath = userManager.getAuthorizable("Mytestissng2dcddcdxsx ").getPath()
Node node = session.getNode(NodePath );
/* Add profile node and add properies to profile node like profileNode.setProperty("timeNow", System.currentTimeMillis()); */
but userManager.getAuthorizable("Mytestissng2dcddcdxsx ").getPath(); is saying The method getPath() is undefined for the type Authorizable. Is there a way i can get the node name from usermanager api by passing the username of the user as a parameter ?
As i don't have control over the node name that is getting created i am not able frame a path like " /home/users/myproject/+nodenameoftheuser " and then test if one such node exists and get that node using the path Session.getNode( " /home/users/myproject/+nodenameoftheuser ")
Any help is appreciated.
Solved! Go to Solution.
Views
Replies
Total Likes
It is the actual behavior of AEM in its latest versions. So you will have to use queries to get the path
Views
Replies
Total Likes
Hi,
please see an earlier thread on how AEM 6.1 now creates the path for users:
Regards,
Opkar
Views
Replies
Total Likes
It is the actual behavior of AEM in its latest versions. So you will have to use queries to get the path
Views
Replies
Total Likes
Views
Likes
Replies