Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

user creation in repository via a registration form

Avatar

Level 5

Looking at how geometrix and geometrixx outdoors registration works.

If I create users with a new registration form without specifying a path under which users should be created , users are created under /home/users/a/abcd and /home/users/b/bdcb and so on.

But if I specify a path i.e. /home/users/myApp/india all users are created under same folder , this would mean a flat node structure under this path so if I have 10K users in india , I will have 10K nodes under india folder , not good right?(tried with creating 500 users).

How can I make registration work in below mentioned way.

Path to create users is authorable in registration form - (so india site reg form will create users under  /home/users/myApp/india and brazil site reg will create users in /home/users/myApp/brazil.

And user creation maintains hierarchical structure of folders rather than flat structure.so something like (/home/users/myApp/india/a/abcd_user and /home/users/myApp/brazil/a/adc_user)

Thanks in advance.

 

Regards,

Allhad

5 Replies

Avatar

Administrator

Hi 

Please have a look at this Helpx article:

Link:- https://helpx.adobe.com/experience-manager/using/jackrabbit-users.html

// This articles covers "Using Jackrabbit UserManager APIs to create AEM Users and Groups"

Here also, you are creating a user using form submission.

Code Used within OSGI is:- 

               
         Group group=userManager.createGroup(groupName,new SimplePrincipal(groupName),"/home/groups/test"); 
         
         Value value=adminSession.getValueFactory().createValue("Sample Group", PropertyType.STRING);
         group.setProperty("./profile/givenName", value);
          
         value=adminSession.getValueFactory().createValue("Test Group", PropertyType.STRING);
         group.setProperty("./profile/aboutMe", value);
          
         value=adminSession.getValueFactory().createValue("abc@gmail.com", PropertyType.STRING);
         group.setProperty("./profile/email", value); 

 

I hope this what you want. I hope this would help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Level 5

Not exactly what I am looking for Kautuk.

Do you have any other references?

Avatar

Administrator

asn_177 wrote...

Not exactly what I am looking for Kautuk.

Do you have any other references?

 

Can you please further clear what is the need ?

The link i shared, is informing you with hot to create a custom component to create new users using UserManager API. 

Inside a code you can also specify the path where you would like a user to be created. 

If you need to create a Login Component, then we have OOTB login component that you can find/Explore in http://localhost:4502/editor.html/content/geometrixx-outdoors/en.html.

~kautuk



Kautuk Sahni

Avatar

Level 10

You asked how you can control creating users so they do not end up in same JCR location, Kautuk pointed you how to create users where you have the ability via the user manager api to place users in the exact JCR path you want.  

Avatar

Level 5

@scott and @Kautuk,

Thanks for pointing.

This will enable me to create users in any path(Intermediate path property). I see that this can be done by passing Intermediate path to createUser method of UserManager API.

But if you do not specify an intermediate path , the default (/home/user) is chosen to create users under with intermediatefolders i.e. /home/user/a/abcUser is created.

But if I pass intermediate path I lose this behaviour which I want (i.e. I want intermediate folders to get automatically created (/a/) in my path.

Below mentioned is excerpt from UserManagerImpl API :

The built-in logic applies the following rules:

  • The names of the hierarchy folders is determined from ID of the authorizable to be created, consisting of the leading N chars where N is the relative depth starting from the node at getUsersPath() or getGroupsPath().
  • By default 2 levels (depth == 2) are created.
  • Parent nodes are expected to consist of folder structure only.
  • If the ID contains invalid JCR chars that would prevent the creation of a Node with that name, the names of authorizable node and the intermediate hierarchy nodes are escaped.

Examples: Creating an non-existing user with ID 'aSmith' without specifying an intermediate path would result in the following structure:

 + rep:security            [nt:unstructured] + rep:authorizables     [rep:AuthorizableFolder] + rep:users           [rep:AuthorizableFolder] + a                 [rep:AuthorizableFolder] + aS              [rep:AuthorizableFolder] + aSmith        [rep:User]

Creating a non-existing user with ID 'aSmith' specifying an intermediate path 'some/tree' would result in the following structure:

 + rep:security            [nt:unstructured] + rep:authorizables     [rep:AuthorizableFolder] + rep:users           [rep:AuthorizableFolder] + some              [rep:AuthorizableFolder] + tree            [rep:AuthorizableFolder] + aSmith        [rep:User]

 

Regards,

Allhad