-
1. Re: Getting a list of roles from Identity
wachtda.scsi.gmx.ch Aug 4, 2009 9:33 AM (in response to lholmquist)Yes you can gather the roles of a user like this:
#{identityManager.getImpliedRoles(USERNAME)}
-
2. Re: Getting a list of roles from Identity
lholmquist Aug 4, 2009 3:54 PM (in response to lholmquist)Thanks for the quick reply. what version of seam is this in. I am using jboss developer studio and chose the Seam 2.0 project wizard. I was unable to find the IdentityManager class. I would also like to point out that i am a Seam noob
thanks
-
3. Re: Getting a list of roles from Identity
lholmquist Aug 4, 2009 6:23 PM (in response to lholmquist)If i use the 2.1 project wizard, its there.
Another Question. I'm new to seam and have been using the Seam Framework second edition book. I see that using the IdentityManager u can do all the CRUD operations with it. I don't normally mapped my pojo's to a db. i like to write the querys myself. How do u extend the Identity Manager functionallity to write those custom query's.
i'm sorry if this is not a seam question
-
4. Re: Getting a list of roles from Identity
mroeoesli Aug 7, 2009 11:16 AM (in response to lholmquist)if you just wan't to know the roles hold in the identity object you can try this:
public List<String> getIdentityRoles(Identity identity) { List<String> roles = new ArrayList<String>(); Subject subject = identity.getSubject(); for (Group sg : subject.getPrincipals(Group.class)) { if (Identity.ROLES_GROUP.equals(sg.getName())) { Enumeration<Principal> e = (Enumeration<Principal>) sg.members(); while (e.hasMoreElements()) { Principal member = (Principal) e.nextElement(); roles.add(member.getName()); } } } return roles; }
Greetz Marco