[UX] #605 make permission wizard safety review actionable
This commit is contained in:
@@ -195,25 +195,32 @@ public class PermissionController {
|
||||
|
||||
@PostMapping("/permissions")
|
||||
public String save(
|
||||
@RequestParam long roleId,
|
||||
@RequestParam String objectRef,
|
||||
@RequestParam(required = false) Long roleId,
|
||||
@RequestParam(required = false) String objectRef,
|
||||
@RequestParam(defaultValue = "ALLOW") String permissionEffect,
|
||||
@RequestParam(required = false) List<String> ruleColumn,
|
||||
@RequestParam List<String> ruleType,
|
||||
@RequestParam(required = false) List<String> ruleType,
|
||||
@RequestParam(required = false) List<String> ruleValue,
|
||||
@RequestParam(required = false) String visibleColumns,
|
||||
RedirectAttributes redirectAttributes
|
||||
) {
|
||||
long objectId = resolveObjectId(objectRef);
|
||||
permissionService.savePermissionSet(new PermissionSetCommand(
|
||||
roleId,
|
||||
objectId,
|
||||
"SELECT",
|
||||
permissionEffect,
|
||||
buildRules(ruleColumn, ruleType, ruleValue),
|
||||
splitColumns(visibleColumns)
|
||||
));
|
||||
redirectAttributes.addFlashAttribute("message", "권한을 저장했습니다.");
|
||||
try {
|
||||
if (roleId == null) {
|
||||
throw new AppException("권한을 적용할 역할을 선택하세요.");
|
||||
}
|
||||
long objectId = resolveObjectId(objectRef);
|
||||
permissionService.savePermissionSet(new PermissionSetCommand(
|
||||
roleId,
|
||||
objectId,
|
||||
"SELECT",
|
||||
permissionEffect,
|
||||
buildRules(ruleColumn, ruleType, ruleValue),
|
||||
splitColumns(visibleColumns)
|
||||
));
|
||||
redirectAttributes.addFlashAttribute("message", "권한을 저장했습니다.");
|
||||
} catch (AppException | IllegalArgumentException exception) {
|
||||
redirectAttributes.addFlashAttribute("error", exception.getMessage());
|
||||
}
|
||||
return "redirect:/permissions";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user