Madhavi Ginjupalli wrote:
> 
> Hi,
> 
> When a user logs in , depending on his
> role, a particular layout template has to
> be chosen. This layout template will have
> place holders for the navigation and the screen.
> Depending on the user's
> role, the links in the navigation template
> will be dynamically built. For example, if a
> manager logs in then his links on the navigation
> bar will be create account, view history, view invoice,
> create order etc. If a ordinary worker were to log
> in he would have links like view profile, view products
> etc.
> 
> once the user is logged in, throughout his session i would
> like to have the same layout template(whatever is chosen depending
> on his role). As long he gets the same layout throughout his
> session, i think even the navigation templates referred within
> his layout get automatically handled(i mean as long as the lay
> out is the same, the same navigation links are always shown
> through out his session.)
> 
> The first time a user logs in, the screen to be rendered
> will be one of those represented or referenced in the
> navigation bar. So a manager after logging may get to Createaccount.vm
> and an ordinary worker may get to viewprofile.vm.
> 
> Is is possible to do this kind of template management which
> is tightly coupled to the user's role? If yes, any suggestions
> on how to go about solving this would be appreciated.
> 
> Thanks
> Madhavi

In your equivalent of org.apache.mycompany.modules.screens.SecureScreen,
add

            if(acl.hasRole("manager")) {
                data.getTemplateInfo().setLayoutTemplate("/Manager.vm");
            }
 
in the isAuthorized method. So long as all your screens extend
SecureScreen, managers will always get the Manager layout.

Charles


> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
> Jason van Zyl
> Sent: Wednesday, May 23, 2001 11:10 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Resend-- Session handling - setting layout templates on a
> session basis.
> 
> Madhavi Ginjupalli wrote:
> >
> > Hi friends,
> >
> > Im my application, every logged user
> > belongs to a role(for example manager, worker etc).
> > The business logic is such that each role has a
> > predefined layout(which is available as a .vm file
> > in the layout directory). Once the user logs in,
> > i have to choose a template that fits his role
> > and as long as he stays in the session, the same
> > layout should be used for all the forthcoming screens.
> >
> > Im finding that i will have to explicitely do a
> > data.setLayoutTemplate() in every screen. Is there anything
> > in the framework which allows me to set session wise
> > defaults (like layout templates, background color etc)?
> >
> 
> So do you basically want the same content for each type of
> user but just different layouts and navigations?
> 
> For example, do you want to have the same Index.vm
> for all the users but have different navigations
> depending on the user who is logged in. Maybe a
> different menu across the top for different users.
> 
> If you explained a little more, I might be able
> to give you some specific help.
> 
> --
> jvz.
> 
> Jason van Zyl
> [EMAIL PROTECTED]
> 
> http://jakarta.apache.org/velocity
> http://jakarta.apache.org/turbine
> http://jakarta.apache.org/commons
> http://tambora.zenplex.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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

Reply via email to