Control Scheduling in JasperReports Server

2019-08-05 07:12发布

I want to prevent normal users from scheduling a report. Only administrator will have the right to schedule report. Is it possible with JasperReports Server?

1条回答
\"骚年 ilove
2楼-- · 2019-08-05 07:35

Yes, it is possible.

You should edit the jasperserver\WEB-INF\actionModel-search.xml file.

You need to find the definition of ScheduleAction action in this file and add the condition for the ROLE_ADMINISTRATOR role:

<context name="resource_menu">
    <simpleAction labelKey="RM_BUTTON_RUN" action="invokeRedirectAction" actionArgs="RunResourceAction"
                  clientTest="canBeRun" className="up"/>
    <condition test="isSupportedDevice">
        <simpleAction labelKey="RM_BUTTON_RUN_IN_BACKGROUND" action="invokeRedirectAction" actionArgs="RunInBackgroundResourceAction"
                      clientTest="canBeRunInBackground" className="up"/>
            <condition test="checkAuthenticationRoles" testArgs="ROLE_ADMINISTRATOR">                         
                <simpleAction labelKey="RM_BUTTON_SCHEDULE_REPORT" action="invokeRedirectAction" actionArgs="ScheduleAction"
                              clientTest="canBeScheduled" className="up"/>
            </condition>          
        <simpleAction labelKey="RM_BUTTON_WIZARD" action="invokeRedirectAction" actionArgs="EditResourceAction"
                      clientTest="canResourceBeEdited" className="up"/>
    </condition>

I've just add the <condition test="checkAuthenticationRoles" testArgs="ROLE_ADMINISTRATOR"> for the ScheduleAction action.

After that you should restart the application server (Tomcat).

查看更多
登录 后发表回答