implementing user manager

2 messages Options
Embed this post
Permalink
anand

implementing user manager

Reply Threaded More More options
Print post
Permalink
Hello Users,

                  My repository needs more than one user access in that case i went through source code and there i found some helpful methods but still puzzled before customizing. What i need is new user should be able to create his own account and based on roles/groups in which he is, would be able to access content in repository. Which means there should be one common account(may be admin/root) using which new user can create a account and that would be saved in repository.

I need some basic idea if someone had already done anything related to this before.

Also, i need to know if we would be able to create new user then where its going to get saved/reside in repository.

Waiting for response

Thanks,
simer
anand

Need Help implementing user manager

Reply Threaded More More options
Print post
Permalink
Hello Users,

                As i was told inorder to implement the UserManager I need to customize the SecurityMananger and need to use the UserManager class then i looked into it i found this CreateUser method which returns the new user. I looked up this method in org.apache.jackrabbit.core.security.user.UserManagerImpl class.

    public User createUser(String userID, String password,
                           Principal principal, String intermediatePath)
            throws AuthorizableExistsException, RepositoryException {
        if (userID == null || password == null || principal == null) {
            throw new IllegalArgumentException("Not possible to create user with null parameters");}
            if (getAuthorizable(userID) != null) {
            throw new AuthorizableExistsException("User for '" + userID + "' already exists");}        }
        if (hasAuthorizableOrReferee(principal)) {
            throw new AuthorizableExistsException("Authorizable for '" + principal.getName() + "' already exists"); }
        NodeImpl parent = null;
        try {
            String parentPath = getParentPath(intermediatePath, getCurrentUserPath());
            parent = createParentNode(parentPath);
            Name nodeName = session.getQName(Text.escapeIllegalJcrChars(userID));
            NodeImpl userNode = addSecurityNode(parent, nodeName, NT_REP_USER);
            setSecurityProperty(userNode, P_USERID, getValue(userID));
            setSecurityProperty(userNode, P_PASSWORD, getValue(UserImpl.buildPasswordValue(password)));
            setSecurityProperty(userNode, P_PRINCIPAL_NAME, getValue(principal.getName()));
            parent.save();
            log.info("User created: " + userID + "; " + userNode.getPath());
            return createUser(userNode);
            }

1.  In this try block i don't know what these first three  lines are meant for so please any one here who has any idea  please let me know how i can implement this if i want to use CreateUser(String Id, String Password) method .

2.  and from where does this CreateUser() method will be called in order to create new user
 
3. This method returns new user, will it be stored in Repository so that we can again use that user account.

3.  If we customize this class then how we will implement it in repository.xml file since there is no Entry for UserManager like <UserManager class= "  ">




Reply Needed.
Thanks,
Simer

Please Have a look at it.