10-10-2012 02:16 AM
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");
}
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 user10-10-2012 02:43 AM
What is the Concept of ROLE,USER,User group authority in alfresco? How they differ from each other?
10-10-2012 03:29 AM
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");
}
by this code, Person with user details is created, but when I try to check if that person authority exists, then it fails..i.e., Person is created but User Authority is not created, so I am not able to add this user to a group or a role, and not able to authenticate user with AuthenticationService.authenticate to access ServiceRegistry, it says Authority doesn't exist.
if(!authService.authorityExists(authService.getName(AuthorityType.USER, "myUsername"))){
System.out.println("Usr Authority doesn't exists");
}else{
System.out.println("Usr Authority exists");
}
10-10-2012 04:42 AM
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");
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.