on 05-29-2007 12:48 PM
Hi,
I am trying to assign portal users to portal role using the IRoleFactory and IRole class of Secutiy API from my web dynpro application.
For getting the role , i can use either the uniqueId of the role or the uniqueName of the role.(Using methods of IRole class, getRole(uid) or getRoleByUniqueName(uname)).
The UniqueId of roles contains some hash values and cannot be used. For example ROLE.PCD_ROLE_PERSISTENCE.6dT95vZpyNWQHm59z7B9FxAM/fg=.
And the for getting the role using the uniqueName, i need to give like pcd:portal_content/other_vendors/<folder name>/<my prefix>.<rolename>. Which is also not feasible.
Is there any way to get the role only using the role name that we give while creating it?
Thanks and Regards,
Venkat
Hi,
Check if this helps.
try {
IRoleFactory rfact = UMFactory.getRoleFactory();
IRoleSearchFilter isf = rfact.getRoleSearchFilter();
isf.setDisplayName ("*",ISearchAttribute.LIKE_OPERATOR,false);
ISearchResult rit = rfact.searchRoles(isf);
while(rit.next()!=null){
String roleName = (String) rit.next();
IRole role = rfact.getRole(roleName);
response.write("nRole:" + role.getUniqueName());
}
}catch(Exception e){
response.write("exception");
}
U will get list of roles. U can pass these directly or use String tokenizer to separate the role name alone using '.' as separator.
Regards,
Vijai
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.