[Opensource] Redirect users after login

Peter A. J. Pilgrim peterp at xenonsoft.demon.co.uk
Tue Dec 3 19:57:46 PST 2002


Hi Brian, Kris

I added more compatibility to Struts such dynamic action forward could be
created. There is a new class `com.jcorporate.expresso.core.controller.ServletControllerResponse'
and some changes to `com.jcorporate.expresso.core.controller.ServletControllerRequest'

In your controller one simply down casts


protected void runProcessFormState(
	ControllerRequest  request
	ControllerResponse  response )
{


	ServletControllerRequest  servReq =
		(ServletControllerRequest)  request;
	ServletControllerResponse  servRes =
		(ServletControllerResponse)  response;


	servRes.setActionForward(
		new ActionForward( "dummy", "context-sensitive-url" ));

}

You can store your context sensitives URL in a database.

Or write some URL that is fits your criteria e.g

	servRes.findForwardStore(
		"special_forward_"+XYZ.getSecurityGroupName() );

	// e.g "special_forward_Admin"
	// e.g "special_forward_Everyone"
	// e.g "special_forward_None"
	//
	// But Make sure you define these in the action-config those


Thompson, Kris wrote:
> There isn't any functionality "out-of-the-box" for doing this  (at least 
> none that know of at the moment) but there are plenty of ways to do this.  
>  
> One solution is to  (I have implemented but not sure if recommend)  have 
> a controller for displaying your home page and for each group that has 
> its own page create a state in that controller like 
> runDisplaySysAdminPageState, runDisplayGroupAdminPageState, etc. then in 
> the config file each state maps to a jsp page.  Lastly in the 
> LoginController you would have to place logic in there to decide which 
> state to goto next, this could be done by getting the groups (vector) 
> that the user belongs to (see User.getGroups()).  The problem with this 
> implementation is if you either have a lot of groups or need to add 
> groups on the fly this solutions, doesn't fly
>  
> I would love to hear other developers solutions to this issue.
>  
> Kris
>  
> [Thompson, Kris]  -----Original Message-----
> *From:* Brian Chow [mailto:bchow9 at hotmail.com]
> *Sent:* Tuesday, November 26, 2002 2:41 PM
> *To:* Opensource at jcorporate.com
> *Subject:* [Opensource] Redirect users after login
> 
>     Hi,
> 
>     Can anyone tell me how to redirect users to different startup pages
>     after they log in.
> 
>     For example, group administrators would go to an administration page
>     for their individual group; system administrators would go to an
>     unrestricted system administration page; and normal users would go
>     to view and update their profile.
> 
>     Thanks,
> 
>     Brian
> 
> 
>     ------------------------------------------------------------------------
>     Protect your PC - Click here <http://g.msn.com/8HMEEN/2024> for
>     McAfee.com VirusScan Online
>     _______________________________________________ Opensource mailing
>     list Opensource at jcorporate.com
>     http://mail.jcorporate.com/mailman/listinfo/opensource Archives:
>     http://mail.jcorporate.com/pipermail/opensource/ 


-- 
Peter Pilgrim
ServerSide Java Specialist

My on-line resume and for interview videos about myself, J2EE
Open Source, Struts and Expresso.
    ||
    \\===>  `` http://www.xenonsoft.demon.co.uk/no-it-striker.html ''




More information about the Opensource mailing list