-
Notifications
You must be signed in to change notification settings - Fork 177
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 (#3577)
* Deprecate & Swap for Auth over DashboardConfig for group configs * Added tests and adjusted logic to meet missing error logic * Fix useGroups & update ssar check to patch * Update where to look for the dropdown values in cypress * Switch to GET over SSAR to not lock cluster-admins * Fix tests
- Loading branch information
1 parent
4260e3e
commit 075914a
Showing
23 changed files
with
491 additions
and
127 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { AuthKind } from '~/k8sTypes'; | ||
|
||
type MockAuthData = { | ||
adminGroups?: string[]; | ||
allowedGroups?: string[]; | ||
}; | ||
|
||
export const mockAuth = ({ | ||
adminGroups = ['odh-admins'], | ||
allowedGroups = ['system:authenticated'], | ||
}: MockAuthData = {}): AuthKind => ({ | ||
apiVersion: 'services.platform.opendatahub.io/v1alpha1', | ||
kind: 'Auth', | ||
metadata: { | ||
name: 'auth', | ||
}, | ||
spec: { | ||
adminGroups, | ||
allowedGroups, | ||
}, | ||
}); |
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 getAuth = (): Promise<AuthKind> => | ||
k8sGetResource<AuthKind>({ model: AuthModel, queryOptions: { name: AUTH_SINGLETON_NAME } }); | ||
|
||
export type GroupData = { adminGroups?: string[]; allowedGroups?: string[] }; | ||
export const patchAuth = (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.