mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 18:15:53 +00:00
Replace scopes with role for ST V3
This commit is contained in:
@@ -4,17 +4,6 @@ import {
|
||||
UserAgentType
|
||||
} from "./enums";
|
||||
|
||||
enum Permission {
|
||||
READ = "read",
|
||||
READ_WRITE = "readWrite"
|
||||
}
|
||||
|
||||
interface Scope {
|
||||
environment: string;
|
||||
secretPath: string;
|
||||
permission: Permission;
|
||||
}
|
||||
|
||||
interface UserActorMetadata {
|
||||
userId: string;
|
||||
email: string;
|
||||
@@ -211,7 +200,7 @@ interface CreateServiceTokenV3Event {
|
||||
metadata: {
|
||||
name: string;
|
||||
isActive: boolean;
|
||||
scopes: Array<Scope>;
|
||||
role: string;
|
||||
expiresAt?: Date;
|
||||
}
|
||||
}
|
||||
@@ -221,7 +210,7 @@ interface UpdateServiceTokenV3Event {
|
||||
metadata: {
|
||||
name?: string;
|
||||
isActive?: boolean;
|
||||
scopes?: Array<Scope>;
|
||||
role?: string;
|
||||
expiresAt?: Date;
|
||||
}
|
||||
}
|
||||
@@ -231,7 +220,7 @@ interface DeleteServiceTokenV3Event {
|
||||
metadata: {
|
||||
name: string;
|
||||
isActive: boolean;
|
||||
scopes: Array<Scope>;
|
||||
role?: string;
|
||||
expiresAt?: Date;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,8 +85,8 @@ export const useUpdateServiceTokenV3 = () => {
|
||||
mutationFn: async ({
|
||||
serviceTokenDataId,
|
||||
name,
|
||||
role,
|
||||
isActive,
|
||||
scopes,
|
||||
trustedIps,
|
||||
expiresIn,
|
||||
accessTokenTTL,
|
||||
@@ -94,8 +94,8 @@ export const useUpdateServiceTokenV3 = () => {
|
||||
}) => {
|
||||
const { data: { serviceTokenData } } = await apiRequest.patch(`/api/v3/service-token/${serviceTokenDataId}`, {
|
||||
name,
|
||||
role,
|
||||
isActive,
|
||||
scopes,
|
||||
trustedIps,
|
||||
expiresIn,
|
||||
accessTokenTTL,
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { Permission } from "./enums";
|
||||
|
||||
export type ServiceTokenScope = {
|
||||
environment: string;
|
||||
secretPath: string;
|
||||
@@ -38,12 +36,6 @@ export type DeleteServiceTokenRes = { serviceTokenData: ServiceToken };
|
||||
|
||||
// --- v3
|
||||
|
||||
export type ServiceTokenV3Scope = {
|
||||
permissions: Permission[];
|
||||
environment: string;
|
||||
secretPath: string;
|
||||
};
|
||||
|
||||
export type ServiceTokenV3TrustedIp = {
|
||||
_id: string;
|
||||
ipAddress: string;
|
||||
@@ -54,13 +46,13 @@ export type ServiceTokenV3TrustedIp = {
|
||||
export type ServiceTokenDataV3 = {
|
||||
_id: string;
|
||||
name: string;
|
||||
role: string;
|
||||
workspace: string;
|
||||
isActive: boolean;
|
||||
refreshTokenLastUsed?: string;
|
||||
accessTokenLastUsed?: string;
|
||||
refreshTokenUsageCount: number;
|
||||
accessTokenUsageCount: number;
|
||||
scopes: ServiceTokenV3Scope[];
|
||||
trustedIps: ServiceTokenV3TrustedIp[];
|
||||
expiresAt?: string;
|
||||
accessTokenTTL: number;
|
||||
@@ -71,9 +63,9 @@ export type ServiceTokenDataV3 = {
|
||||
|
||||
export type CreateServiceTokenDataV3DTO = {
|
||||
name: string;
|
||||
role?: string;
|
||||
workspaceId: string;
|
||||
publicKey: string;
|
||||
scopes: ServiceTokenV3Scope[];
|
||||
trustedIps: {
|
||||
ipAddress: string;
|
||||
}[];
|
||||
@@ -93,7 +85,7 @@ export type UpdateServiceTokenDataV3DTO = {
|
||||
serviceTokenDataId: string;
|
||||
isActive?: boolean;
|
||||
name?: string;
|
||||
scopes?: ServiceTokenV3Scope[];
|
||||
role?: string;
|
||||
trustedIps?: {
|
||||
ipAddress: string;
|
||||
}[];
|
||||
|
||||
Reference in New Issue
Block a user