mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-17 08:35:52 +00:00
feat: implemented user role impersonation
This commit is contained in:
@@ -0,0 +1 @@
|
||||
export { useAssumeProjectPrivileges, useRemoveAssumeProjectPrivilege } from "./mutations";
|
||||
@@ -0,0 +1,26 @@
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { TProjectAssumePrivilegesDTO } from "./types";
|
||||
import { apiRequest } from "@app/config/request";
|
||||
|
||||
export const useAssumeProjectPrivileges = () =>
|
||||
useMutation({
|
||||
mutationFn: async ({ projectId, actorId, actorType }: TProjectAssumePrivilegesDTO) => {
|
||||
const { data } = await apiRequest.post<{ message: string }>(
|
||||
`/api/v1/workspace/${projectId}/assume-privileges`,
|
||||
{ actorId, actorType }
|
||||
);
|
||||
|
||||
return data;
|
||||
}
|
||||
});
|
||||
|
||||
export const useRemoveAssumeProjectPrivilege = () =>
|
||||
useMutation({
|
||||
mutationFn: async ({ projectId }: { projectId: string }) => {
|
||||
const { data } = await apiRequest.delete<{ message: string }>(
|
||||
`/api/v1/workspace/${projectId}/assume-privileges`
|
||||
);
|
||||
|
||||
return data;
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
import { ActorType } from "../auditLogs/enums";
|
||||
|
||||
export type TProjectAssumePrivilegesDTO = {
|
||||
projectId: string;
|
||||
actorType: ActorType;
|
||||
actorId: string;
|
||||
};
|
||||
Reference in New Issue
Block a user