Thanks Alex

I was struggling to find the source download - for anyone interested the 
solution is along the following lines:


                    Application app = (Application) 
session.getServletContext();
                    JaffaAuthenticator myAuth = 
(JaffaAuthenticator)app.getAuthenticator();
                    JaffaPrincipal myPrincipal = 
(JaffaPrincipal)request.getUserPrincipal();
                    myAuth.loadEntityRoles(myPrincipal, 
ugb.getCurrentBusinessID());  // this proprietary method refreshes the 
roles and sets them on the principal

There might be other ways of doing it but this works and provides a 
useful way to refresh the roles programatically as required and avoids 
needing to make database calls for each request to check roles. it also 
allows for different role queries to be used as required where the role 
query may need to vary according to a differing user context.

Regards


Alan




Alex wrote:
>> Hi
>>
>> We are implementing user roles.
>>
>> Within a user session the roles that apply to them can change during the 
>> session at defined points where they "open" a company file and start 
>> working in the context of a different business. A user may have access 
>> to multiple businesses and their roles may be different in different 
>> businesses.
>>
>> Is it possible to get the principal, update the roles, and store the 
>> principal back in the session or wherever it is stored? I am working 
>> with 2.1.17
>>     
> I don't have a solution for your exact requirements, but you should be able 
> to figure some things out by looking at the Authenticator code at 
>
>  http://www.caucho.com/download/resin-2.1.17-src.tar.gz
>
>   
>   


-- 


Alan Wright
Athene Systems

tel 0845 230 9803


Athene Systems Limited
Registered Office:
Shieling House
Invincible Road
Farnborough
GU14 7QU

Registered in England and Wales No. 3156080



_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to