mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 21:40:31 +00:00
Continue ST V3 roles
This commit is contained in:
@@ -2,7 +2,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { apiRequest } from "@app/config/request";
|
||||
|
||||
import { workspaceKeys } from "../workspace/queries";
|
||||
import { organizationKeys } from "../organization/queries";
|
||||
import {
|
||||
CreateServiceTokenDataV3DTO,
|
||||
CreateServiceTokenDataV3Res,
|
||||
@@ -74,7 +74,7 @@ export const useCreateServiceTokenV3 = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: ({ serviceTokenData }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceServiceTokenDataV3(serviceTokenData.workspace));
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgServiceMemberships(serviceTokenData.organization));
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -104,8 +104,8 @@ export const useUpdateServiceTokenV3 = () => {
|
||||
|
||||
return serviceTokenData;
|
||||
},
|
||||
onSuccess: ({ workspace }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceServiceTokenDataV3(workspace));
|
||||
onSuccess: ({ organization }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgServiceMemberships(organization));
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -119,8 +119,8 @@ export const useDeleteServiceTokenV3 = () => {
|
||||
const { data: { serviceTokenData } } = await apiRequest.delete(`/api/v3/service-token/${serviceTokenDataId}`);
|
||||
return serviceTokenData;
|
||||
},
|
||||
onSuccess: ({ workspace }) => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getWorkspaceServiceTokenDataV3(workspace));
|
||||
onSuccess: ({ organization }) => {
|
||||
queryClient.invalidateQueries(organizationKeys.getOrgServiceMemberships(organization));
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -1,3 +1,5 @@
|
||||
import { TRole } from "../roles/types";
|
||||
|
||||
export type ServiceTokenScope = {
|
||||
environment: string;
|
||||
secretPath: string;
|
||||
@@ -46,12 +48,7 @@ export type ServiceTokenV3TrustedIp = {
|
||||
export type ServiceTokenDataV3 = {
|
||||
_id: string;
|
||||
name: string;
|
||||
role: string;
|
||||
customRole?: {
|
||||
name: string;
|
||||
slug: string;
|
||||
};
|
||||
workspace: string;
|
||||
organization: string;
|
||||
isActive: boolean;
|
||||
refreshTokenLastUsed?: string;
|
||||
accessTokenLastUsed?: string;
|
||||
@@ -65,18 +62,35 @@ export type ServiceTokenDataV3 = {
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
export type ServiceMembershipOrg = {
|
||||
_id: string;
|
||||
service: ServiceTokenDataV3;
|
||||
organization: string;
|
||||
role: "admin" | "member" | "viewer" | "custom";
|
||||
customRole?: TRole;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export type ServiceMembership = {
|
||||
_id: string;
|
||||
service: ServiceTokenDataV3;
|
||||
organization: string;
|
||||
role: "admin" | "member" | "viewer" | "custom";
|
||||
customRole?: TRole;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export type CreateServiceTokenDataV3DTO = {
|
||||
name: string;
|
||||
organizationId: string;
|
||||
role?: string;
|
||||
workspaceId: string;
|
||||
publicKey: string;
|
||||
trustedIps: {
|
||||
ipAddress: string;
|
||||
}[];
|
||||
expiresIn?: number;
|
||||
accessTokenTTL: number;
|
||||
encryptedKey: string;
|
||||
nonce: string;
|
||||
isRefreshTokenRotationEnabled: boolean;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user