throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.E0401, OozieClient.USER_NAME);
}
if (!requestUser.equals(UNDEF) && !user.equals(requestUser)) {
throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.E0400, requestUser, user);
}
AuthorizationService auth = Services.get().get(AuthorizationService.class);
if (acl != null){
conf.set(OozieClient.GROUP_NAME, acl);
}
else if (acl == null && auth.useDefaultGroupAsAcl()) {
acl = auth.getDefaultGroup(user);
conf.set(OozieClient.GROUP_NAME, acl);
}
XLog.Info.get().setParameter(XLogService.GROUP, acl);
String wfPath = conf.get(OozieClient.APP_PATH);
String coordPath = conf.get(OozieClient.COORDINATOR_APP_PATH);
String bundlePath = conf.get(OozieClient.BUNDLE_APP_PATH);
if (wfPath == null && coordPath == null && bundlePath == null) {
String[] libPaths = conf.getStrings(XOozieClient.LIBPATH);
if (libPaths != null && libPaths.length > 0 && libPaths[0].trim().length() > 0) {
conf.set(OozieClient.APP_PATH, libPaths[0].trim());
wfPath = libPaths[0].trim();
}
else {
throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.E0405);
}
}
ServletUtilities.ValidateAppPath(wfPath, coordPath, bundlePath);
if (wfPath != null) {
auth.authorizeForApp(user, acl, wfPath, "workflow.xml", conf);
}
else if (coordPath != null){
auth.authorizeForApp(user, acl, coordPath, "coordinator.xml", conf);
}
else if (bundlePath != null){
auth.authorizeForApp(user, acl, bundlePath, "bundle.xml", conf);
}
}
catch (AuthorizationException ex) {
XLog.getLog(BaseJobServlet.class).info("AuthorizationException ", ex);
throw new XServletException(HttpServletResponse.SC_UNAUTHORIZED, ex);