Jump to content
We've recently updated our Privacy Statement, available here ×
  • How to write conditions when you do not have a specific role


    Sarthak Chaudhary
    • Features: Repository Version: v8.1.0 Product: JasperReports® Server

    Requirement: 

    We are trying to limit the items that appear in the JRS menu by referring to the following site:

    https://community.tibco.com/s/article/how-limit-non-admin-users-ability-create-or-view

    If "testArgs="ROLE_SUPERUSER,ROLE_TEST"" is written, the condition will be matched if the user has either "ROLE_SUPERUSER" or "ROLE_TEST". I want to match a user who has "ROLE_SUPERUSER" but not "ROLE_TEST" to a condition. How do I describe the condition that I do not have "ROLE_TEST"? 

    Recommendation: 

    Below would work. For users with "ROLE_TEST", we will not have a view menu option.

        <!--context for view option on primary menu-->
            <context name="main_view_mutton" test="checkAuthenticationRoles" testArgs="ROLE_SUPERUSER">
                <condition test="!checkAuthenticationRoles" testArgs="ROLE_TEST">
                <selectAction labelKey="menu.repository">
                    <option labelKey="menu.search" action="primaryNavModule.navigationOption" actionArgs="search"/>
                    <option labelKey="menu.all" action="primaryNavModule.navigationOption" actionArgs="browse"/>
                    <option labelKey="menu.favorites" action="primaryNavModule.navigationOption" actionArgs="favorites"/>
                    <option labelKey="menu.jobs" action="primaryNavModule.navigationOption" actionArgs="jobs"/>
    <!--
                    <option labelKey="menu.reports" action="primaryNavModule.navigationOption" actionArgs="report"/>
                    <condition test="isCEVersion">
                        <option labelKey="menu.olap.views" action="primaryNavModule.navigationOption" actionArgs="olap"/>
                    </condition>
                    <condition test="isProVersion">
                        <condition test="isAvailableProFeature" testArgs="ANA">
                            <option labelKey="menu.olap.views" action="primaryNavModule.navigationOption" actionArgs="olap"/>
                        </condition>
                    </condition>
    -->
                    <option labelKey="menu.events" action="primaryNavModule.navigationOption" actionArgs="event"/>
                </selectAction>
                </condition>
            </context>


    User Feedback

    Recommended Comments

    There are no comments to display.



    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...