添加安全组页面和安全规则页面
This commit is contained in:
+2
-2
@@ -6,9 +6,9 @@ import lombok.Getter;
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum SecurityRulePassTypeEnum {
|
||||
DENY(-1, "DENY"),
|
||||
DENY(0, "deny"),
|
||||
ALLOW(1, "allow"),
|
||||
NONE(0, "none")
|
||||
NONE(-1, "none")
|
||||
;
|
||||
|
||||
private final Integer code;
|
||||
|
||||
+7
-1
@@ -36,6 +36,12 @@ public class SecurityController {
|
||||
return groupDOList.stream().map(SecurityGroupDO::toRes).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Get
|
||||
@Mapping("/group/getOne")
|
||||
public SecurityGroupRes getGroupOne(Integer groupId) {
|
||||
return groupService.queryGroupOne(groupId).toRes();
|
||||
}
|
||||
|
||||
@Post
|
||||
@Mapping("/group/create")
|
||||
public void createGroup(SecurityGroupCreateReq req) {
|
||||
@@ -50,7 +56,7 @@ public class SecurityController {
|
||||
|
||||
/**
|
||||
* 将级联删除对应规则,并更新缓存
|
||||
* @param groupId
|
||||
* @param groupId 安全组Id
|
||||
*/
|
||||
@Post
|
||||
@Mapping("/group/delete")
|
||||
|
||||
+6
-2
@@ -61,6 +61,10 @@ public class SecurityGroupService {
|
||||
.eq(SecurityGroupDO::getUserId, SystemContextHolder.getUserId()));
|
||||
}
|
||||
|
||||
public SecurityGroupDO queryGroupOne(Integer groupId) {
|
||||
return securityGroupMapper.selectById(groupId);
|
||||
}
|
||||
|
||||
public void createGroup(SecurityGroupCreateReq req) {
|
||||
SecurityGroupDO groupDO = new SecurityGroupDO();
|
||||
BeanUtil.copyProperties(req, groupDO);
|
||||
@@ -80,8 +84,8 @@ public class SecurityGroupService {
|
||||
}
|
||||
|
||||
public void setGroupStatus(Integer groupId, EnableStatusEnum statusEnum) {
|
||||
SecurityGroupDO groupDO = securityGroupMap.get(groupId);
|
||||
if (groupDO == null || groupDO.getEnable() == EnableStatusEnum.DISABLE) {
|
||||
SecurityGroupDO groupDO = securityGroupMapper.selectById(groupId);
|
||||
if (groupDO == null) {
|
||||
throw new RuntimeException("指定的安全组不存在");
|
||||
}
|
||||
groupDO.setEnable(statusEnum);
|
||||
|
||||
Reference in New Issue
Block a user