UserData userData = (UserData)context.getCachedObject("TargetUserData"); Vector roleList = SecurityUtils.getRoleList(userData);
oracle ucm: How to get the user group and role list?
-
31-03-2022 - |
Question
I wanted to get the list which includes the all group and roles of a user in Oracle Universal Content management.
ex: If user is weblogic, Group :Administrtor Role :manager,Admin ,etc
I tried as :
Subject subject = Security.getCurrentSubject();
Set prin=subject.getPrincipals();
But got only group with this .Please provide a code snippet to do this.
Solution 2
OTHER TIPS
Listing the members of a group is possible because a group has a defined membership list
A role is different - a role defines a set of rules that can be evaluated to determine if a user is a member. A role's membership may change on something like the day of the week.
Therefore, to get see what roles a certain user is in, you have to do a check against each role. Something like what is described here:
http://blog.watashii.com/2010/06/weblogic-portal-authorization-get-and-check-users-roles/
If you already know all of the roles (and have them in a list) you can simply iterate over the list and do:
request.isUserInRole("xxxxx")