* Intersects two allowlists. If either is null (unrestricted), returns the other. * If both are set, returns only items present in both.
(a: string[] | null, b: string[] | null)
| 61 | * If both are set, returns only items present in both. |
| 62 | */ |
| 63 | function intersectAllowlists(a: string[] | null, b: string[] | null): string[] | null { |
| 64 | if (a === null) return b |
| 65 | if (b === null) return a.map((i) => i.toLowerCase()) |
| 66 | return a.map((i) => i.toLowerCase()).filter((i) => b.includes(i)) |
| 67 | } |
| 68 | |
| 69 | export function usePermissionConfig(): PermissionConfigResult { |
| 70 | const params = useParams() |
no outgoing calls
no test coverage detected