review code.
This commit is contained in:
34
orion-ops-ui/src/api/asset/asset-authorized-data.ts
Normal file
34
orion-ops-ui/src/api/asset/asset-authorized-data.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import type { HostGroupQueryResponse } from '@/api/asset/host-group';
|
||||
import type { HostQueryResponse } from './host';
|
||||
import type { HostKeyQueryResponse } from './host-key';
|
||||
import type { HostIdentityQueryResponse } from './host-identity';
|
||||
import axios from 'axios';
|
||||
|
||||
/**
|
||||
* 已授权的主机分组 查询响应
|
||||
*/
|
||||
export interface AuthorizedHostGroupQueryResponse {
|
||||
groupTree: Array<HostGroupQueryResponse>;
|
||||
hostList: Array<HostQueryResponse>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前用户已授权的主机分组
|
||||
*/
|
||||
export function getCurrentAuthorizedHostGroup() {
|
||||
return axios.get<AuthorizedHostGroupQueryResponse>('/asset/authorized-data/current-host-group');
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前用户已授权的主机秘钥
|
||||
*/
|
||||
export function getCurrentAuthorizedHostKey() {
|
||||
return axios.get<HostKeyQueryResponse>('/asset/authorized-data/current-host-key');
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前用户已授权的主机身份
|
||||
*/
|
||||
export function getCurrentAuthorizedHostIdentity() {
|
||||
return axios.get<HostIdentityQueryResponse>('/asset/authorized-data/current-host-identity');
|
||||
}
|
||||
60
orion-ops-ui/src/api/asset/asset-data-grant.ts
Normal file
60
orion-ops-ui/src/api/asset/asset-data-grant.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import axios from 'axios';
|
||||
|
||||
/**
|
||||
* 数据授权 请求对象
|
||||
*/
|
||||
export interface AssetDataGrantRequest {
|
||||
userId?: number;
|
||||
roleId?: number;
|
||||
idList?: Array<number>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权数据 查询请求对象
|
||||
*/
|
||||
export interface AssetAuthorizedDataQueryRequest {
|
||||
userId?: number;
|
||||
roleId?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主机分组授权
|
||||
*/
|
||||
export function grantHostGroup(request: AssetDataGrantRequest) {
|
||||
return axios.put('/asset/host-group/grant-host-group', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已授权的主机分组
|
||||
*/
|
||||
export function getAuthorizedHostGroup(params: AssetAuthorizedDataQueryRequest) {
|
||||
return axios.get<Array<number>>('/asset/data-grant/get-host-group', { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 主机秘钥授权
|
||||
*/
|
||||
export function grantHostKey(request: AssetDataGrantRequest) {
|
||||
return axios.put('/asset/host-group/grant-host-key', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已授权的主机秘钥
|
||||
*/
|
||||
export function getAuthorizedHostKey(params: AssetAuthorizedDataQueryRequest) {
|
||||
return axios.get<Array<number>>('/asset/data-grant/get-host-key', { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 主机身份授权
|
||||
*/
|
||||
export function grantHostIdentity(request: AssetDataGrantRequest) {
|
||||
return axios.put('/asset/host-group/grant-host-identity', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已授权的主机身份
|
||||
*/
|
||||
export function getAuthorizedHostIdentity(params: AssetAuthorizedDataQueryRequest) {
|
||||
return axios.get<Array<number>>('/asset/data-grant/get-host-identity', { params });
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import type { HostGroupQueryResponse } from '@/api/asset/host-group';
|
||||
import axios from 'axios';
|
||||
|
||||
/**
|
||||
* 查询已授权的主机分组
|
||||
*/
|
||||
export function getAuthorizedHostGroup() {
|
||||
return axios.get<Array<HostGroupQueryResponse>>('/asset/authorized-data/host-group');
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { HostQueryResponse } from './host';
|
||||
import axios from 'axios';
|
||||
|
||||
/**
|
||||
@@ -33,7 +34,7 @@ export interface HostGroupQueryResponse {
|
||||
parentId: number;
|
||||
title: string;
|
||||
children: Array<HostGroupQueryResponse>;
|
||||
hosts: Array<number>;
|
||||
hostList: Array<HostQueryResponse>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,21 +45,6 @@ export interface HostGroupRelUpdateRequest {
|
||||
hostIdList?: Array<string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主机分组授权 查询请求对象
|
||||
*/
|
||||
export interface HostGroupGrantQueryRequest {
|
||||
userId?: number;
|
||||
roleId?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主机分组 授权请求对象
|
||||
*/
|
||||
export interface HostGroupGrantRequest extends HostGroupGrantQueryRequest {
|
||||
groupIdList?: Array<number>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建主机分组
|
||||
*/
|
||||
@@ -107,17 +93,3 @@ export function getHostGroupRelList(groupId: number) {
|
||||
export function updateHostGroupRel(request: HostGroupRelUpdateRequest) {
|
||||
return axios.put('/asset/host-group/update-rel', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已授权的分组
|
||||
*/
|
||||
export function getAuthorizedHostGroup(params: HostGroupGrantQueryRequest) {
|
||||
return axios.get<Array<number>>('/asset/host-group/get-authorized-group', { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 主机分组授权
|
||||
*/
|
||||
export function grantHostGroup(request: HostGroupGrantRequest) {
|
||||
return axios.put('/asset/host-group/grant', request);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user