Jump to content
We've recently updated our Privacy Statement, available here ×
  • Hide the library icon by role in 5.1


    ghudson_1
    • Features: JasperReports Server Version: v5.5, v5.3, v5.2, v5.1 Product: JasperReports® Server

    Issue Description:

    A customer wants to hide the Library Icon conditionally based on a user's role.


    Resolution:

    To hide the library icon for all users you'll need to modify the decorator in /WEB-INF/decorators/decorator.jsp.  Find and remove the tags:

    [toc]
    <li id="main_library" tabIndex="-1" class="leaf">
        <p class="wrap button">
            <span class="icon"></span>
            <spring:message code="menu.library"/>
        </p>
    </li>
    

    The above would hide for all users.  To conditionally show the icon to a particular role, wrap the above tags with our js:authorize tag, like:

    <js:authorize ifAllGranted="ROLE_SUPERUSER">
        <li id="main_library" tabIndex="-1" class="leaf">
            <p class="wrap button">
                <span class="icon"></span>
                <spring:message code="menu.library"/>
            </p>
        </li>
    </js:authorize>
    

    This was originally created for 5.1, but it still applies in 5.5 as well.


    Reference:

    Chapter "11.7 Customizing Menus" in our JasperReports Server Ultimate Guide v5 in our Documents Area

    Ref. Case #00032944


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...