AnsweredAssumed Answered

Difference Between Authorities & Person, User, Role, Group

Question asked by pramodkhare on Oct 10, 2012
Latest reply on Oct 10, 2012 by anujs86
Hi I want to know the Concept of Alfresco Authority.  (Note - I am using Alfresco Foundation APi)

When I create User I create Authentication for that user and then I create person node for that user


if(!authenticationService.authenticationExists(userName)){
              authenticationService.createAuthentication(userName, userName.toCharArray());
              if(perService.personExists(userName)){
                 HashMap<QName, Serializable> properties = new HashMap<QName, Serializable>();
                   properties.put(ContentModel.PROP_USERNAME, userName);
                   properties.put(ContentModel.PROP_PASSWORD, userName);
                   properties.put(ContentModel.PROP_FIRSTNAME, userName);
                   properties.put(ContentModel.PROP_LASTNAME, userName);
                  
                 perService.createPerson(properties);
              }
           }else{
              System.out.println("Usr already exists");
           }

Now there is Concept of USER Authority TYPE also. So If I try to create USER authority form AuthorityService then it gives Exception.

AuthorityService authorityService = serviceRegistry.getAuthorityService();
authService.createAuthority(AuthorityType.USER, "tempUser");
Now if I create User using Person service and then When I want to add user to a UserGroup it gives Exception No Authority Found for user

So I am not able to add Users to user-Groups.

There is one more thing I want to know-
What is the Concept of ROLE,USER,Usergroup authority in alfresco? How they differ from each other?

Now can users be added to ROLE, like user group?

Can a Role be assigned permissions -like Read,Write or any custom permission -group created in permissionDefinition.xml?

In a Usergroup and Role and User, what is precedence level of permission on a node, consider its a permission on node (and not global permission or inherited permission)?

Sorry I am asking too many questions. but I have gone through Alfresco Wiki , but there is no clear difference mentioned there.

Outcomes