refactor: 重构主机分组页面.
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
### 查询已授权的主机分组
|
||||
GET {{baseUrl}}/asset/authorized-data/host-group
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
@@ -41,3 +41,23 @@ Authorization: {{token}}
|
||||
DELETE {{baseUrl}}/asset/host-group/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 获取已授权的分组
|
||||
GET {{baseUrl}}/asset/host-group/get-authorized-group?userId=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 主机分组授权
|
||||
PUT {{baseUrl}}/asset/host-group/grant
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"userId": 10,
|
||||
"groupIdList": [
|
||||
3,
|
||||
5
|
||||
]
|
||||
}
|
||||
|
||||
###
|
||||
|
||||
@@ -103,14 +103,11 @@ public class HostGroupController {
|
||||
return HttpWrapper.ok();
|
||||
}
|
||||
|
||||
// TODO 日志 host-group:grant
|
||||
// TODO 菜单 asset:host-group:grant
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/get-authorized-group")
|
||||
@Operation(summary = "获取已授权的分组")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host-group:grant')")
|
||||
public List<Long> getAuthorizedHostGroup(@RequestParam HostGroupGrantQueryRequest request) {
|
||||
public List<Long> getAuthorizedHostGroup(HostGroupGrantQueryRequest request) {
|
||||
return hostGroupService.getAuthorizedHostGroup(request);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import lombok.NoArgsConstructor;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 主机分组 查询请求对象
|
||||
* 主机分组授权 查询请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
@@ -19,7 +19,7 @@ import java.io.Serializable;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "HostGroupQueryRequest", description = "主机分组 查询请求对象")
|
||||
@Schema(name = "HostGroupQueryRequest", description = "主机分组授权 查询请求对象")
|
||||
public class HostGroupGrantQueryRequest implements Serializable {
|
||||
|
||||
@Schema(description = "用户id")
|
||||
|
||||
@@ -19,10 +19,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 主机分组服务 实现类
|
||||
@@ -155,7 +152,7 @@ public class HostGroupServiceImpl implements HostGroupService {
|
||||
// 构建已授权的分组
|
||||
List<DataGroupDTO> relNodes = new ArrayList<>();
|
||||
TreeUtils.getAllNodes(dataGroup, authorizedGroupIdList, relNodes);
|
||||
dataGroup = relNodes;
|
||||
dataGroup = new ArrayList<>(new HashSet<>(relNodes));
|
||||
}
|
||||
// 查询分组引用
|
||||
Map<Long, Set<Long>> groupRel = dataGroupRelApi.getGroupRelList(DataGroupTypeEnum.HOST);
|
||||
|
||||
Reference in New Issue
Block a user