-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate & Swap for Auth over DashboardConfig for group configs
- Loading branch information
1 parent
4510b81
commit 2a290bf
Showing
20 changed files
with
375 additions
and
108 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
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,34 @@ | ||
import { k8sGetResource, k8sPatchResource, Patch } from '@openshift/dynamic-plugin-sdk-utils'; | ||
import { AuthModel } from '~/api'; | ||
import { AuthKind } from '~/k8sTypes'; | ||
|
||
export const AUTH_SINGLETON_NAME = 'auth'; | ||
|
||
export const getAuthResource = (): Promise<AuthKind> => | ||
k8sGetResource<AuthKind>({ model: AuthModel, queryOptions: { name: AUTH_SINGLETON_NAME } }); | ||
|
||
export type GroupData = { adminGroups?: string[]; allowedGroups?: string[] }; | ||
export const patchAuthResource = (groupData: GroupData): Promise<AuthKind> => { | ||
const { adminGroups, allowedGroups } = groupData; | ||
const patches: Patch[] = []; | ||
if (adminGroups) { | ||
patches.push({ | ||
value: adminGroups, | ||
op: 'replace', | ||
path: '/spec/adminGroups', | ||
}); | ||
} | ||
if (allowedGroups) { | ||
patches.push({ | ||
value: allowedGroups, | ||
op: 'replace', | ||
path: '/spec/allowedGroups', | ||
}); | ||
} | ||
|
||
return k8sPatchResource<AuthKind>({ | ||
model: AuthModel, | ||
queryOptions: { name: AUTH_SINGLETON_NAME }, | ||
patches, | ||
}); | ||
}; |
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.