use of com.vip.saturn.job.console.aop.annotation.Audit in project Saturn by vipshop.
the class AuthorizationManageController method deleteUserRole.
@ApiResponses(value = { @ApiResponse(code = 200, message = "Success/Fail", response = RequestResult.class) })
@Audit
@PostMapping("/deleteUserRole")
public SuccessResponseEntity deleteUserRole(@AuditParam("userName") @RequestParam String userName, @AuditParam("roleKey") @RequestParam String roleKey, @AuditParam("namespace") @RequestParam String namespace) throws SaturnJobConsoleException {
assertIsSystemAdmin();
UserRole userRole = new UserRole();
userRole.setUserName(userName);
userRole.setRoleKey(roleKey);
userRole.setNamespace(namespace);
String currentLoginUserName = getCurrentLoginUserName();
userRole.setLastUpdatedBy(currentLoginUserName);
authorizationManageService.deleteUserRole(userRole);
return new SuccessResponseEntity();
}
use of com.vip.saturn.job.console.aop.annotation.Audit in project Saturn by vipshop.
the class JobOverviewController method exportSelectedJobs.
// 导出选定的作业
@ApiResponses(value = { @ApiResponse(code = 200, message = "Success/Fail", response = RequestResult.class) })
@Audit
@GetMapping(value = "/exportSelected")
public void exportSelectedJobs(final HttpServletRequest request, @AuditParam("namespace") @PathVariable String namespace, @RequestParam(required = false) List<String> jobList, final HttpServletResponse response) throws SaturnJobConsoleException {
// assertIsPermitted(PermissionKeys.jobExport, namespace);
File exportJobFile = jobService.exportSelectedJobs(namespace, jobList);
String currentTime = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
String exportFileName = namespace + "_" + currentTime + ".xls";
SaturnConsoleUtils.exportFile(response, exportJobFile, exportFileName, true);
}
use of com.vip.saturn.job.console.aop.annotation.Audit in project Saturn by vipshop.
the class ZkDiscoveryRestApiController method discoverZk.
@Audit(type = AuditType.REST)
@RequestMapping(value = "/discoverZk", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<Object> discoverZk(String namespace, HttpServletRequest request) throws SaturnJobConsoleException {
HttpHeaders headers = new HttpHeaders();
try {
checkMissingParameter("namespace", namespace);
String zkClusterKey = namespaceZkclusterMapping4SqlService.getZkClusterKey(namespace);
if (zkClusterKey == null) {
throw new SaturnJobConsoleHttpException(HttpStatus.NOT_FOUND.value(), "The namespace:[" + namespace + "] is not registered in Saturn.");
}
ZkClusterInfo zkClusterInfo = zkClusterInfoService.getByClusterKey(zkClusterKey);
if (zkClusterInfo == null) {
throw new SaturnJobConsoleHttpException(HttpStatus.INTERNAL_SERVER_ERROR.value(), "The clusterKey: [" + zkClusterKey + "] is not configured in db for " + namespace);
}
return new ResponseEntity<Object>(zkClusterInfo.getConnectString(), headers, HttpStatus.OK);
} catch (SaturnJobConsoleException e) {
throw e;
} catch (Exception e) {
throw new SaturnJobConsoleHttpException(HttpStatus.INTERNAL_SERVER_ERROR.value(), e.getMessage(), e);
}
}
use of com.vip.saturn.job.console.aop.annotation.Audit in project Saturn by vipshop.
the class ConsoleConfigController method createConfig.
/**
* 创建配置项。
*
* @param key 配置key
* @param value 配置值
*/
@ApiResponses(value = { @ApiResponse(code = 200, message = "Success/Fail", response = RequestResult.class) })
@Audit
@PostMapping("/create")
public SuccessResponseEntity createConfig(@AuditParam(value = "key") @RequestParam String key, @AuditParam(value = "value") @RequestParam String value) throws SaturnJobConsoleException {
assertIsPermitted(PermissionKeys.systemConfig);
// 不能更新EXECUTOR_CONFIGS
if (SystemConfigProperties.EXECUTOR_CONFIGS.equals(key)) {
throw new SaturnJobConsoleException(String.format("配置项不能为%s", key));
}
SystemConfig systemConfig = new SystemConfig();
systemConfig.setProperty(key);
systemConfig.setValue(value);
systemConfigService.createConfig(systemConfig);
return new SuccessResponseEntity();
}
Aggregations