You can get the group membership of a user with a certain role as follows:


Pass the following criteria to the getGroups(Criteria) method of
TurbineSecurityService.

   Criteria criteria = new Criteria();
   criteria.addJoin(GroupPeer.GROUP_ID, UserGroupRolePeer.GROUP_ID);
   criteria.addJoin(UserGroupRolePeer.USER_ID, TurbineUserPeer.USER_ID);
   criteria.addJoin(UserGroupRolePeer.ROLE_ID, RolePeer.ROLE_ID);
   criteria.add(TurbineUserPeer.USERNAME, user.getUserName());
   criteria.add(RolePeer.NAME,role.getName());


   GroupSet groups = TurbineSecurit.getGroups(criteria);

----- Original Message -----
From: "Phillip Rhodes" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 15, 2002 8:46 PM
Subject: security usage question


> all,
>
> I am writing a survey application.  That is, users login and based upon
> their identity will see a set of surveys that they can respond to.
>
> There may be thousands of users, and a hundred different surveys.  I am
> unsure how I would use the Turbine security system to do this.  How would
I
> be able to get a list of surveys that a user can respond to?
>
> I would like to create a group for each survey and assign users to that
> group with the role of "Responder"
>
> So for each survey, there would be a group
> Users who could respond to the survey would be given the role "Responder"
> for the group that represents the survey they can respond to.
>
> My problem here is that  I KNOW the required role ("Responder"), but I do
> not know the group membership of the user.  There is no way to get the
> groups that a user is a member of.
>
> It seems that I must know the Group to get a role, but there is no way to
> get groups for a given role.  I could then take those groups and do a
query
> against a table I created that defines a survey to group mapping.
>
>
> I would appreciate any thoughts.
>
> Phillip
>
>
>
>
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to