Jump to content
Changes to the Jaspersoft community edition download ×
  • How to customize Navigation resource menu (right-click on resource)


    dnaboka
    • Features: JasperReports Server, Repository, User Interface Version: v5.5 Product: JasperReports® Server

    By default next actions are available for superuser on resource in repository (e.g. report):

    • Run
    • Run in New Tab
    • Run in background
    • Schedule
    • Edit
    • Copy
    • Cut
    • Delete

    Untitled(9).jpg.f945483fc050999e5e17f8ee28532dcd.jpg

    If you want to show/hide one of the items for a specific role you need to edit ./jasperserver-pro/WEB-INF/actionModel-search.xml

    Choose appropriate condition from one of the actionArgs under <context name="resource_menu"> (section that starts on line 150)

    Let me demonstrate a couple of examples:

    1. Allow only users with ROLE_ADMINISTRATOR to Schedule a report

      • You will need to add "checkAuthenticationRoles" condition for actionArgs="ScheduleAction"

      <condition test="checkModeAndDevice" testArgs="browse,search,library">
          <condition test="checkAuthenticationRoles" testArgs="ROLE_ADMINISTRATOR">
              <simpleAction labelKey="RM_BUTTON_SCHEDULE_REPORT" 
                            action="invokeRedirectAction" actionArgs="ScheduleAction" 
                            clientTest="canBeScheduled"   className="up"/>
          </condition>
      </condition>
      
    2. Allow only users with ROLE_ADMINISTRATOR, ROLE_DEMO to Cut a report

      • add "checkAuthenticationRoles" condition for actionArgs="Move"

      <condition test="checkMode" testArgs="browse">
          <simpleAction labelKey="RM_BUTTON_COPY_RESOURCE"
                        action="invokeResourceAction"    actionArgs="Copy" 
                        clientTest="canResourceBeCopied" className="up"/>
          <condition test="checkAuthenticationRoles" testArgs="ROLE_DEMO,ROLE_ADMINISTRATOR">
              <simpleAction labelKey="RM_BUTTON_MOVE_RESOURCE" 
                            action="invokeResourceAction"   actionArgs="Move" 
                            clientTest="canResourceBeMoved" className="up"/>
          </condition>
      </condition
      
    3. Allow users to Edit a report, domain, datasource etc from Library (by default, user can only do this from Search and Repository)

      • edit testArgs for actionArgs="EditResourceAction"

      <condition test="checkModeAndDevice" testArgs="browse,search,library">
          <simpleAction labelKey="RM_BUTTON_WIZARD" 
                        action="invokeRedirectAction"    actionArgs="EditResourceAction" 
                        clientTest="canResourceBeEdited" className="up"/>
      </condition>
      
    4. Deny users with ROLE_USER to Copy resource from Repository

      • add "!checkAuthenticationRoles" condition for actionArgs="Copy"

      <condition test="checkMode" testArgs="browse">
          <condition test="!checkAuthenticationRoles" testArgs="ROLE_USER">
              <simpleAction labelKey="RM_BUTTON_COPY_RESOURCE" 
                            action="invokeResourceAction"    actionArgs="Copy" 
                            clientTest="canResourceBeCopied" className="up"/>
          </condition>
          <simpleAction labelKey="RM_BUTTON_MOVE_RESOURCE" 
                        action="invokeResourceAction"   actionArgs="Move" 
                        clientTest="canResourceBeMoved" className="up"/>
      </condition>
      

    Untitled(9).jpg.92c55f98aed9be51a32c335f223341f0.jpg

    actionmodel-search.xml


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...