-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: restricted permissions for permission management [WD-18906] (#1113
- Loading branch information
Showing
43 changed files
with
763 additions
and
354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { useQuery } from "@tanstack/react-query"; | ||
import { queryKeys } from "util/queryKeys"; | ||
import { UseQueryResult } from "@tanstack/react-query"; | ||
import { useAuth } from "./auth"; | ||
import { LxdGroup } from "types/permissions"; | ||
import { fetchGroups } from "api/auth-groups"; | ||
|
||
export const useGroups = (): UseQueryResult<LxdGroup[]> => { | ||
const { isFineGrained } = useAuth(); | ||
return useQuery({ | ||
queryKey: [queryKeys.authGroups], | ||
queryFn: () => fetchGroups(isFineGrained), | ||
enabled: isFineGrained !== null, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { useQuery } from "@tanstack/react-query"; | ||
import { queryKeys } from "util/queryKeys"; | ||
import { UseQueryResult } from "@tanstack/react-query"; | ||
import { useAuth } from "./auth"; | ||
import { LxdIdentity } from "types/permissions"; | ||
import { fetchIdentities, fetchIdentity } from "api/auth-identities"; | ||
|
||
export const useIdentities = (): UseQueryResult<LxdIdentity[]> => { | ||
const { isFineGrained } = useAuth(); | ||
return useQuery({ | ||
queryKey: [queryKeys.identities], | ||
queryFn: () => fetchIdentities(isFineGrained), | ||
enabled: isFineGrained !== null, | ||
}); | ||
}; | ||
|
||
export const useIdentity = ( | ||
id: string, | ||
authMethod: string, | ||
enabled?: boolean, | ||
): UseQueryResult<LxdIdentity> => { | ||
const { isFineGrained } = useAuth(); | ||
return useQuery({ | ||
queryKey: [queryKeys.identities, authMethod, id], | ||
queryFn: () => fetchIdentity(id, authMethod, isFineGrained), | ||
enabled: (enabled ?? true) && isFineGrained !== null, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { useQuery } from "@tanstack/react-query"; | ||
import { queryKeys } from "util/queryKeys"; | ||
import { UseQueryResult } from "@tanstack/react-query"; | ||
import { useAuth } from "./auth"; | ||
import { IdpGroup } from "types/permissions"; | ||
import { fetchIdpGroups } from "api/auth-idp-groups"; | ||
|
||
export const useIdpGroups = (): UseQueryResult<IdpGroup[]> => { | ||
const { isFineGrained } = useAuth(); | ||
return useQuery({ | ||
queryKey: [queryKeys.idpGroups], | ||
queryFn: () => fetchIdpGroups(isFineGrained), | ||
enabled: isFineGrained !== null, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.