Title: Message

 

Hi Brendan,

 

That’s the path that I’m starting to head down.

 

I have the managed bean with the user info in. This is populated by an action method from the first page.

 

How did you get you bean to be populated before then?

Are you using JAAS ?

 

Thanks

Jeff.

 

 

-----Original Message-----
From: CONNER, BRENDAN (SBCSI) [mailto:[EMAIL PROTECTED]
Sent: 20 October 2005 15:07
To: MyFaces Discussion
Subject: RE: User Management - advice needed.

 

We have a managed bean representing the user with session scope that is filled out when the user successfully logs in by the managed bean responsible for login.  Any page then has access to the user's information.

 

Our managed bean responsible for the login process has a managed property referring to the managed bean that actually contains the user information.  This is all defined in our faces-config.xml file.

 

- Brendan

-----Original Message-----
From: Jeffrey Porter [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 20, 2005 7:39 AM
To: MyFaces Discussion
Subject: User Management - advice needed.

 

Hello again.

 

My question is this.

 

I want when a JSF page is displayed, to look up the current user and display some information on them.

For example…

 

<%

Principal principal = request.getUserPrincipal();

      String userName = principal.getName();

      User user = SomeUserManagementServerThing.loadUser(userName);

%>

 

<%=userName%>

<%=user.isAdmin()%>

 

The above code is fine for the old JSP/Struts way of doing thing. But what is the approach I should take in MyFaces?

 

If the action method that makes the call to display the page knew about the Principle I could pass the User object in and all would be great.

But I don’t see a way for an action method to find out the currently logged in user.

 

What do you guys think? Is a there a paper / tutorial already on this that I’ve missed?

 

Thanks

Jeff

 

Using: JBoss 4.02, JAAS, DatabaseAuthentication

Reply via email to