|
@@ -69,7 +69,7 @@ public class PropertyController {
|
|
@RequestParam Long versionId, @RequestParam Long moduleId, @RequestParam MultipartFile file,
|
|
@RequestParam Long versionId, @RequestParam Long moduleId, @RequestParam MultipartFile file,
|
|
@RequestParam FileFormat extension, @RequestParam(required = false) Long inheritVersionId)
|
|
@RequestParam FileFormat extension, @RequestParam(required = false) Long inheritVersionId)
|
|
throws IOException {
|
|
throws IOException {
|
|
- adminSession.validateRole(Role.DEV);
|
|
|
|
|
|
+ adminSession.validateRole(Role.ADMIN, Role.DEV);
|
|
adminSession.validateApp(appService.getById(appId));
|
|
adminSession.validateApp(appService.getById(appId));
|
|
return propertyService.updateBaseline(appService.getById(appId), versionService.getById(versionId),
|
|
return propertyService.updateBaseline(appService.getById(appId), versionService.getById(versionId),
|
|
moduleService.getById(moduleId), file.getInputStream(), extension,
|
|
moduleService.getById(moduleId), file.getInputStream(), extension,
|
|
@@ -78,7 +78,7 @@ public class PropertyController {
|
|
|
|
|
|
@PostMapping("/baseline/item/update")
|
|
@PostMapping("/baseline/item/update")
|
|
public PropertyItem updateBaselineItem(@RequestAttribute AdminSession adminSession, PropertyItem item) {
|
|
public PropertyItem updateBaselineItem(@RequestAttribute AdminSession adminSession, PropertyItem item) {
|
|
- adminSession.validateRole(Role.DEV);
|
|
|
|
|
|
+ adminSession.validateRole(Role.ADMIN, Role.DEV);
|
|
adminSession.validateApp(appService.getById(item.getAppId()));
|
|
adminSession.validateApp(appService.getById(item.getAppId()));
|
|
return propertyService.updateBaselineItem(item);
|
|
return propertyService.updateBaselineItem(item);
|
|
}
|
|
}
|
|
@@ -89,8 +89,9 @@ public class PropertyController {
|
|
adminSession.validateApp(appService.getById(appId));
|
|
adminSession.validateApp(appService.getById(appId));
|
|
Env env = envService.getById(envId);
|
|
Env env = envService.getById(envId);
|
|
List<PropertyItem> list = propertyService.listPropertyItem(appId, versionId, moduleId, env.getId());
|
|
List<PropertyItem> list = propertyService.listPropertyItem(appId, versionId, moduleId, env.getId());
|
|
- //非环境可编辑用户,需要隐藏机密信息
|
|
|
|
- if (!adminSession.getUser().hasRole(env.getType().getRole())) {
|
|
|
|
|
|
+ //非管理员/运维角色,且非环境维护用户,需要隐藏机密信息
|
|
|
|
+ if (!adminSession.getUser().hasRole(Role.ADMIN, Role.OPS) && !adminSession.getUser().getId()
|
|
|
|
+ .equals(env.getUserId())) {
|
|
for (PropertyItem item : list) {
|
|
for (PropertyItem item : list) {
|
|
//包含密钥/密码类信息
|
|
//包含密钥/密码类信息
|
|
if (item.getKey().contains("secret") || item.getKey().contains("password")) {
|
|
if (item.getKey().contains("secret") || item.getKey().contains("password")) {
|
|
@@ -113,9 +114,8 @@ public class PropertyController {
|
|
|
|
|
|
@PostMapping("/item/update")
|
|
@PostMapping("/item/update")
|
|
public PropertyItem updatePropertyItem(@RequestAttribute AdminSession adminSession, PropertyItem item) {
|
|
public PropertyItem updatePropertyItem(@RequestAttribute AdminSession adminSession, PropertyItem item) {
|
|
- adminSession.validateRole(Role.TEST, Role.OPS);
|
|
|
|
adminSession.validateApp(appService.getById(item.getAppId()));
|
|
adminSession.validateApp(appService.getById(item.getAppId()));
|
|
- adminSession.validateEnv(envService.getById(item.getEnvId()).getType());
|
|
|
|
|
|
+ adminSession.validateEnv(envService.getById(item.getEnvId()));
|
|
return propertyService.updatePropertyItem(item);
|
|
return propertyService.updatePropertyItem(item);
|
|
}
|
|
}
|
|
|
|
|