How to mention not of hasRole('ROLE_ADMIN') in spring security taglib

Dileepa picture Dileepa · Oct 11, 2013 · Viewed 19.2k times · Source

How would I write following condition using spring security taglib?

<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>

<sec:authorize access="not of hasRole('ROLE_ADMIN')">
   <div> show these for only non admins </div>
</sec:authorize>

Answer

Frederic Close picture Frederic Close · Oct 11, 2013
<sec:authorize access="!hasRole('ROLE_ADMIN')">
   <div> show these for only non admins </div>
</sec:authorize>