@@ -113,6 +113,12 @@ public static String scheduleService(HttpServletRequest request, HttpServletResp
113113 Locale locale = UtilHttp .getLocale (request );
114114 TimeZone timeZone = UtilHttp .getTimeZone (request );
115115
116+ if (!security .hasPermission ("SERVICE_MAINT" , userLogin )) {
117+ String errMsg = UtilProperties .getMessage (ERR_RESOURCE , "coreEvents.not_authorized_to_call" , locale );
118+ request .setAttribute ("_ERROR_MESSAGE_" , errMsg );
119+ return "error" ;
120+ }
121+
116122 Map <String , Object > params = UtilHttp .getParameterMap (request );
117123 // get the schedule parameters
118124 String jobName = (String ) params .remove ("JOB_NAME" );
@@ -434,11 +440,19 @@ public static Object getObjectFromServicePath(String servicePath, Map<String, ?
434440 * @return Response code string
435441 */
436442 public static String runService (HttpServletRequest request , HttpServletResponse response ) {
443+ Security security = (Security ) request .getAttribute ("security" );
444+ GenericValue userLogin = (GenericValue ) request .getSession ().getAttribute ("userLogin" );
437445 // get the mode and service name
438446 String serviceName = request .getParameter ("serviceName" );
439447 String mode = request .getParameter ("mode" );
440448 Locale locale = UtilHttp .getLocale (request );
441449
450+ if (!security .hasPermission ("SERVICE_MAINT" , userLogin )) {
451+ String errMsg = UtilProperties .getMessage (ERR_RESOURCE , "coreEvents.not_authorized_to_call" , locale );
452+ request .setAttribute ("_ERROR_MESSAGE_" , errMsg );
453+ return "error" ;
454+ }
455+
442456 if (UtilValidate .isEmpty (serviceName )) {
443457 String errMsg = UtilProperties .getMessage (ERR_RESOURCE , "coreEvents.must_specify_service_name" , locale );
444458 request .setAttribute ("_ERROR_MESSAGE_" , errMsg );
@@ -450,7 +464,6 @@ public static String runService(HttpServletRequest request, HttpServletResponse
450464 }
451465
452466 // now do a security check
453- Security security = (Security ) request .getAttribute ("security" );
454467 LocalDispatcher dispatcher = (LocalDispatcher ) request .getAttribute ("dispatcher" );
455468
456469 //lookup the service definition to see if this service is externally available, if not require the SERVICE_INVOKE_ANY permission
0 commit comments