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
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:
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>
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
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>
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>
Recommended Comments
There are no comments to display.