You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Shah Amit <am...@hotmail.com> on 2005/06/03 20:31:14 UTC

Re: J2 - Getting all user groups

Hi Ate,

Thanks for the help !!!

Also, another question -- I am using Sturts-Bridge. Is it possible to get 
hold of the GroupManager instance loaded by jetspeed in any of my actions ?? 
...

Thanks,
Amit

----Original Message Follows----
From: Ate Douma <at...@douma.nu>
Reply-To: "Jetspeed Users List" <je...@portals.apache.org>
To: Jetspeed Users List <je...@portals.apache.org>
Subject: Re: J2 - Getting all user groups
Date: Fri, 27 May 2005 17:46:30 +0200

Shah Amit wrote:
>Hi all,
>
>I know that portlet api supports something like 
>request.isuserinrole(somerole). But I want to have something like 
>request.getuser().getAllgroups() and put it in session because I need to 
>access that in my application at lot of places. I use the login portlet 
>provided by jetspeed and the same SPI implementation that ships with 
>jetspeed. I dont mind if jetspeed has something like that and I have to 
>couple my application to jetspeed ...
>
>Any suggestions, ideas ....
Then you want to use
  Collection 
org.apache.jetspeed.security.GroupManager.getGroupsForUser(String username);

You can use the GroupManager in your portlet by adding a 
jetspeed-portlet.xml under WEB-INF
and specifying the service(s) you require.
Look at the jetspeed-portlet.xml provided with the security portlet 
application.
It uses the GroupManager (and several others too).

Once you have this defined, Jetspeed will provide access to the GroupManager 
instance by storing it as an attribute of your PortletContext using the 
org.apache.jetspeed.CommonPortletServices.CPS_GROUP_MANAGER_COMPONENT key.

Both the GroupManager and the CommonPortletServices are interfaces available 
from the jetspeed-api jar.
Look at the org.apache.jetspeed.portlets.security.groups.GroupBrowser 
portlet in the security
portlet application for an example usage.

Good luck, Ate

>
>Thanks,
>Amit
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
>For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>
>
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


Re: J2 - Getting all user groups

Posted by Ate Douma <at...@douma.nu>.
Shah Amit wrote:
> Hi Ate,
> 
> Thanks for the help !!!
> 
> Also, another question -- I am using Sturts-Bridge. Is it possible to 
> get hold of the GroupManager instance loaded by jetspeed in any of my 
> actions ?? ...
If you read up on the Portlet API, you will notice that the PortletContext
and ServletContext attributes must be the same... (PLT.10.3)

> 
> Thanks,
> Amit
> 
> ----Original Message Follows----
> From: Ate Douma <at...@douma.nu>
> Reply-To: "Jetspeed Users List" <je...@portals.apache.org>
> To: Jetspeed Users List <je...@portals.apache.org>
> Subject: Re: J2 - Getting all user groups
> Date: Fri, 27 May 2005 17:46:30 +0200
> 
> Shah Amit wrote:
> 
>> Hi all,
>>
>> I know that portlet api supports something like 
>> request.isuserinrole(somerole). But I want to have something like 
>> request.getuser().getAllgroups() and put it in session because I need 
>> to access that in my application at lot of places. I use the login 
>> portlet provided by jetspeed and the same SPI implementation that 
>> ships with jetspeed. I dont mind if jetspeed has something like that 
>> and I have to couple my application to jetspeed ...
>>
>> Any suggestions, ideas ....
> 
> Then you want to use
>  Collection 
> org.apache.jetspeed.security.GroupManager.getGroupsForUser(String 
> username);
> 
> You can use the GroupManager in your portlet by adding a 
> jetspeed-portlet.xml under WEB-INF
> and specifying the service(s) you require.
> Look at the jetspeed-portlet.xml provided with the security portlet 
> application.
> It uses the GroupManager (and several others too).
> 
> Once you have this defined, Jetspeed will provide access to the 
> GroupManager instance by storing it as an attribute of your 
> PortletContext using the 
> org.apache.jetspeed.CommonPortletServices.CPS_GROUP_MANAGER_COMPONENT key.
> 
> Both the GroupManager and the CommonPortletServices are interfaces 
> available from the jetspeed-api jar.
> Look at the org.apache.jetspeed.portlets.security.groups.GroupBrowser 
> portlet in the security
> portlet application for an example usage.
> 
> Good luck, Ate
> 
>>
>> Thanks,
>> Amit
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
>> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>>
>>
>>
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
> 
> 
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org