TRX 1 rok pred
rodič
commit
cbcd525da8

+ 1 - 1
FullCardClient/src/main/java/com/zhongshu/card/client/model/org/EditAuthParam.java

@@ -13,7 +13,7 @@ public class EditAuthParam {
     private String roleId;
 
     @Schema(description = "操作类型")
-    private EditType type;
+    private EditType type = EditType.Add;
 
     @Schema(description = "权限列表")
     private Set<String> auths;

+ 1 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/org/RoleController.java

@@ -105,7 +105,7 @@ public class RoleController {
     @Operation(summary = "修改角色权限", description = "修改角色权限")
     @ResourceAuth(value = "user", type = AuthType.User)
     @RequestMapping(value = "editRoleAuth", method = {RequestMethod.POST})
-    public Object editRoleAuth(EditAuthParam param) {
+    public Object editRoleAuth(@RequestBody EditAuthParam param) {
         return roleService.editRoleAuth(param);
     }
 

+ 6 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/org/RoleServiceImpl.java

@@ -336,6 +336,7 @@ public class RoleServiceImpl extends SuperService {
         if (role == null) {
             return ResultContent.buildFail("角色不存在");
         }
+
         var roleGroup = roleService.getRoleGroup(role.getRoleGroupId()).getContent();
         com.github.microservice.auth.client.model.RoleModel roleModel;
         if (roleGroup.getRoleId() == null || CollectionUtils.isEmpty(roleGroup.getRoleId())) {
@@ -362,8 +363,13 @@ public class RoleServiceImpl extends SuperService {
         if (CollectionUtils.isEmpty(auth)) {
             auth = new HashSet<>();
         }
+        if (param.getType() == null) {
+            param.setType(EditType.Add);
+        }
 
         if (param.getType() == EditType.Add) {
+            // 最后提交的为准
+            auth = new HashSet<>();
             auth.addAll(param.getAuths());
         } else {
             auth.removeAll(param.getAuths());