mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 08:27:22 +00:00
feat: fetch all user group memberships
This commit is contained in:
@@ -21,6 +21,7 @@ export {
|
|||||||
useGetOrgUsers,
|
useGetOrgUsers,
|
||||||
useGetUser,
|
useGetUser,
|
||||||
useGetUserAction,
|
useGetUserAction,
|
||||||
|
useListUserGroupMemberships,
|
||||||
useLogoutUser,
|
useLogoutUser,
|
||||||
useRegisterUserAction,
|
useRegisterUserAction,
|
||||||
useRevokeMySessions,
|
useRevokeMySessions,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { SessionStorageKeys } from "@app/const";
|
|||||||
import { setAuthToken } from "@app/reactQuery";
|
import { setAuthToken } from "@app/reactQuery";
|
||||||
|
|
||||||
import { APIKeyDataV2 } from "../apiKeys/types";
|
import { APIKeyDataV2 } from "../apiKeys/types";
|
||||||
|
import { TGroupWithProjectMemberships } from "../groups/types";
|
||||||
import {
|
import {
|
||||||
AddUserToOrgDTO,
|
AddUserToOrgDTO,
|
||||||
APIKeyData,
|
APIKeyData,
|
||||||
@@ -38,6 +39,7 @@ export const userKeys = {
|
|||||||
myAPIKeysV2: ["api-keys-v2"] as const,
|
myAPIKeysV2: ["api-keys-v2"] as const,
|
||||||
mySessions: ["sessions"] as const,
|
mySessions: ["sessions"] as const,
|
||||||
listUsers: ["user-list"] as const,
|
listUsers: ["user-list"] as const,
|
||||||
|
listUserGroupMemberships: (username: string) => ["user-group-memberships", username] as const,
|
||||||
|
|
||||||
myOrganizationProjects: (orgId: string) => [{ orgId }, "organization-projects"] as const
|
myOrganizationProjects: (orgId: string) => [{ orgId }, "organization-projects"] as const
|
||||||
};
|
};
|
||||||
@@ -444,3 +446,16 @@ export const fetchMyPrivateKey = async () => {
|
|||||||
|
|
||||||
return privateKey;
|
return privateKey;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const useListUserGroupMemberships = (username: string) => {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: userKeys.listUserGroupMemberships(username),
|
||||||
|
queryFn: async () => {
|
||||||
|
const { data } = await apiRequest.get<TGroupWithProjectMemberships[]>(
|
||||||
|
`/api/v1/user/me/${username}/groups`
|
||||||
|
);
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user