Monday, May 4, 2015

How to Get User Role in JSF

In bean:

FacesContext.getCurrentInstance().getExternalContext().isUserInRole("user");

In JSF page:

<h:panelGroup rendered="#{facesContext.externalContext.isUserInRole('manager')}">
...
</h:panelGroup>

See also:

Common security annotations in Java EE

Popular Posts

Labels

ad ( 5 ) Amazon ( 42 ) Answer ( 1 ) API ( 23 ) automation ( 1 ) blog ( 22 ) book ( 2 ) business ( 1 ) career ( 12 ) cdn ( 3 ) centos ( 1 ) cloud ( 135 ) CRM ( 24 ) current ( 15 ) data ( 17 ) database ( 66 ) design patterns ( 17 ) development ( 3 ) document ( 1 ) eCommerce ( 26 ) email ( 94 ) ETL ( 2 ) file ( 1 ) framework ( 3 ) git ( 11 ) google ( 190 ) IDE ( 19 ) Integration ( 1 ) interview ( 16 ) Java ( 414 ) Java EE ( 111 ) javascript ( 42 ) Jboss ( 4 ) JPA ( 51 ) JSF ( 44 ) linux ( 337 ) Marketing ( 21 ) mobile ( 45 ) model ( 1 ) MySQL ( 199 ) online money ( 16 ) OOP ( 7 ) open source ( 26 ) performance ( 73 ) php ( 51 ) python ( 46 ) quality ( 6 ) referral ( 3 ) restful ( 23 ) security ( 139 ) SEO ( 19 ) social ( 27 ) software ( 76 ) spam ( 4 ) Spring ( 1 ) SQL ( 22 ) system ( 34 ) testing ( 17 ) tool ( 96 ) UML ( 8 ) virtual ( 10 ) web ( 235 ) web services ( 14 ) WildFly ( 7 ) wordpress ( 12 )