How to create conditions based on user role using JSF/MyFaces?

The ExternalContext exposes user and role information.

The ExternalContext exposes user and role information. Public class RolesAccess implements Serializable { public String getUserPrincipalName() { FacesContext context = FacesContext. GetCurrentInstance(); Principal principal = context.

GetExternalContext(). GetUserPrincipal(); if(principal == null) { return null; } return principal.getName(); } public String getUser() { FacesContext context = FacesContext. GetCurrentInstance(); return context.

GetExternalContext().getRemoteUser(); } public boolean isManager() { FacesContext context = FacesContext. GetCurrentInstance(); return context. GetExternalContext().

IsUserInRole("manager"); } } If you're using JSF in servlets, this information maps to the values exposed by the HttpServletRequest. You can use managed beans to expose values to the view via the Expression Language.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions