mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 20:25:43 +00:00
feat: completed new user detail page screen
This commit is contained in:
@@ -15,7 +15,7 @@ export const useCreateProjectUserAdditionalPrivilege = () => {
|
||||
|
||||
return useMutation<{ privilege: TProjectUserPrivilege }, {}, TCreateProjectUserPrivilegeDTO>({
|
||||
mutationFn: async (dto) => {
|
||||
const { data } = await apiRequest.post("/api/v1/additional-privilege/users/permanent", dto);
|
||||
const { data } = await apiRequest.post("/api/v1/user-project-additional-privilege", dto);
|
||||
return data.privilege;
|
||||
},
|
||||
onSuccess: (_, { projectMembershipId }) => {
|
||||
@@ -30,7 +30,7 @@ export const useUpdateProjectUserAdditionalPrivilege = () => {
|
||||
return useMutation<{ privilege: TProjectUserPrivilege }, {}, TUpdateProjectUserPrivlegeDTO>({
|
||||
mutationFn: async (dto) => {
|
||||
const { data } = await apiRequest.patch(
|
||||
`/api/v1/additional-privilege/users/${dto.privilegeId}`,
|
||||
`/api/v1/user-project-additional-privilege/${dto.privilegeId}`,
|
||||
dto
|
||||
);
|
||||
return data.privilege;
|
||||
@@ -47,7 +47,7 @@ export const useDeleteProjectUserAdditionalPrivilege = () => {
|
||||
return useMutation<{ privilege: TProjectUserPrivilege }, {}, TDeleteProjectUserPrivilegeDTO>({
|
||||
mutationFn: async (dto) => {
|
||||
const { data } = await apiRequest.delete(
|
||||
`/api/v1/additional-privilege/users/${dto.privilegeId}`
|
||||
`/api/v1/user-project-additional-privilege/${dto.privilegeId}`
|
||||
);
|
||||
return data.privilege;
|
||||
},
|
||||
|
||||
@@ -15,8 +15,8 @@ const fetchProjectUserPrivilegeDetails = async (privilegeId: string) => {
|
||||
const {
|
||||
data: { privilege }
|
||||
} = await apiRequest.get<{
|
||||
privilege: Omit<TProjectUserPrivilege, "permissions"> & { permissions: unknown };
|
||||
}>(`/api/v1/additional-privilege/users/${privilegeId}`);
|
||||
privilege: Omit<TProjectUserPrivilege, "permissions"> & { permissions: TProjectPermission[] };
|
||||
}>(`/api/v1/user-project-additional-privilege/${privilegeId}`);
|
||||
return privilege;
|
||||
};
|
||||
|
||||
@@ -37,7 +37,7 @@ export const useListProjectUserPrivileges = (projectMembershipId: string) => {
|
||||
data: { privileges }
|
||||
} = await apiRequest.get<{
|
||||
privileges: Array<Omit<TProjectUserPrivilege, "permissions"> & { permissions: unknown }>;
|
||||
}>("/api/v1/additional-privilege/users", { params: { projectMembershipId } });
|
||||
}>("/api/v1/user-project-additional-privilege", { params: { projectMembershipId } });
|
||||
return privileges.map((el) => ({
|
||||
...el,
|
||||
permissions: el.permissions as TProjectPermission[]
|
||||
|
||||
@@ -4,15 +4,6 @@ export enum ProjectUserAdditionalPrivilegeTemporaryMode {
|
||||
Relative = "relative"
|
||||
}
|
||||
|
||||
export type TProjectSpecificPrivilegePermission = {
|
||||
conditions: {
|
||||
environment: string;
|
||||
secretPath?: { $glob: string };
|
||||
};
|
||||
actions: string[];
|
||||
subject: string;
|
||||
};
|
||||
|
||||
export type TProjectUserPrivilege = {
|
||||
projectMembershipId: string;
|
||||
slug: string;
|
||||
@@ -40,11 +31,17 @@ export type TProjectUserPrivilege = {
|
||||
export type TCreateProjectUserPrivilegeDTO = {
|
||||
projectMembershipId: string;
|
||||
slug?: string;
|
||||
isTemporary?: boolean;
|
||||
temporaryMode?: ProjectUserAdditionalPrivilegeTemporaryMode;
|
||||
temporaryRange?: string;
|
||||
temporaryAccessStartTime?: string;
|
||||
permissions: TProjectSpecificPrivilegePermission;
|
||||
type:
|
||||
| {
|
||||
isTemporary: true;
|
||||
temporaryMode?: ProjectUserAdditionalPrivilegeTemporaryMode;
|
||||
temporaryRange?: string;
|
||||
temporaryAccessStartTime?: string;
|
||||
}
|
||||
| {
|
||||
isTemporary: false;
|
||||
};
|
||||
permissions: TProjectPermission[];
|
||||
};
|
||||
|
||||
export type TUpdateProjectUserPrivlegeDTO = {
|
||||
|
||||
@@ -63,16 +63,16 @@ export const useGetProjectRoles = (projectId: string) =>
|
||||
enabled: Boolean(projectId)
|
||||
});
|
||||
|
||||
export const useGetProjectRoleBySlug = (projectSlug: string, roleSlug: string) =>
|
||||
export const useGetProjectRoleBySlug = (projectId: string, roleSlug: string) =>
|
||||
useQuery({
|
||||
queryKey: roleQueryKeys.getProjectRoleBySlug(projectSlug, roleSlug),
|
||||
queryKey: roleQueryKeys.getProjectRoleBySlug(projectId, roleSlug),
|
||||
queryFn: async () => {
|
||||
const { data } = await apiRequest.get<{ role: TProjectRole }>(
|
||||
`/api/v2/workspace/${projectSlug}/roles/slug/${roleSlug}`
|
||||
`/api/v2/workspace/${projectId}/roles/slug/${roleSlug}`
|
||||
);
|
||||
return data.role;
|
||||
},
|
||||
enabled: Boolean(projectSlug && roleSlug)
|
||||
enabled: Boolean(projectId && roleSlug)
|
||||
});
|
||||
|
||||
const getOrgRoles = async (orgId: string) => {
|
||||
|
||||
@@ -23,6 +23,7 @@ export {
|
||||
useGetWorkspaceIntegrations,
|
||||
useGetWorkspaceSecrets,
|
||||
useGetWorkspaceSlackConfig,
|
||||
useGetWorkspaceUserDetails,
|
||||
useGetWorkspaceUsers,
|
||||
useListWorkspaceCas,
|
||||
useListWorkspaceCertificates,
|
||||
@@ -36,7 +37,5 @@ export {
|
||||
useUpdateIdentityWorkspaceRole,
|
||||
useUpdateUserWorkspaceRole,
|
||||
useUpdateWsEnvironment,
|
||||
useUpgradeProject,
|
||||
useGetWorkspaceUserDetails
|
||||
} from "./queries";
|
||||
useUpgradeProject} from "./queries";
|
||||
export { workspaceKeys } from "./query-keys";
|
||||
|
||||
Reference in New Issue
Block a user