Jump to content
We've recently updated our Privacy Statement, available here ×
  • Hide "save button" on input control


    sthomas_3
    • Version: v7.1 Product: JasperReports® Server

    Use Case:

    Need to  hide "save button" on input control Dailog based on logged in  user Role. 

    example: 

    Role: superuser -> display 

    user -> hide 


    Resolution:

    You need to add below taglib in /WEB-INF/jsp/modules/viewReport/ViewReport.jsp after

    <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
    
    <%@ taglib prefix="authz" uri="http://www.springframework.org/security/tags" %>
    
    Then need to locate <button id="save"... and add open and end tag as below.
    
    <authz:authorize ifAnyGranted="ROLE_ADMINISTRATOR">
    
    <button id="save" class="button action up" ${isReportReadOnly ? 'disabled="disabled"':''}><span class="wrap"><spring:message code="button.save" javaScriptEscape="true"/>
    
    <span class="icon"></span></span></button>
    
    </authz:authorize>

    You can add where ever you see <button id="save"...>


    User Feedback

    Recommended Comments

    error when using this solution:

    "Exception occurred rendering view org.springframework.web.servlet.view.JstlView" "name 'modules/viewReport/ViewReport'"

     

    Resolution:

    changed the line from

    <authz:authorize ifAnyGranted="ROLE_ADMINISTRATOR"> 

    to

    <authz:authorize access="hasRole('ROLE_ADMINISTRATOR')">

     

    then it works.

     

    Regards

    Christoph

    Link to comment
    Share on other sites



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...