refactor(用户组与权限): 移除用户组成员校验

This commit is contained in:
shiziyuan9527 2022-12-27 11:17:46 +08:00 committed by lyh
parent 2cbcb79f14
commit 3ec78ee523
3 changed files with 15 additions and 4 deletions

View File

@ -463,6 +463,15 @@ public class GroupService {
}
public void removeGroupMember(String userId, String groupId) {
Group group = groupMapper.selectByPrimaryKey(groupId);
if (group == null) {
MSException.throwException("group does not exist!");
return;
}
if (!StringUtils.equals(group.getType(), UserGroupType.PROJECT)) {
MSException.throwException("no permission to remove non-project type group users!");
return;
}
UserGroupExample userGroupExample = new UserGroupExample();
userGroupExample.createCriteria()
.andGroupIdEqualTo(groupId)

View File

@ -126,6 +126,7 @@ public class GroupController {
}
@GetMapping("/rm/{userId}/{groupId}")
@RequiresPermissions(PermissionConstants.SYSTEM_GROUP_READ)
public void removeGroupMember(@PathVariable String userId, @PathVariable String groupId) {
groupService.removeGroupMember(userId, groupId);
}

View File

@ -162,10 +162,11 @@ public class GroupService {
public void deleteGroup(String id) {
Group group = groupMapper.selectByPrimaryKey(id);
if (group != null) {
if (BooleanUtils.isTrue(group.getSystem())) {
MSException.throwException("系统用户组不支持删除!");
}
if (group == null) {
MSException.throwException("group does not exist!");
}
if (BooleanUtils.isTrue(group.getSystem())) {
MSException.throwException("系统用户组不支持删除!");
}
groupMapper.deleteByPrimaryKey(id);