mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Auth: Store array settings from the config UI in JSON array format (#99454)
* Store array settings in JSON array format * Align tests
This commit is contained in:
parent
154a57cd30
commit
25bb210ca3
@ -52,12 +52,12 @@ const testConfig: SSOProvider = {
|
||||
clientId: '12345',
|
||||
clientSecret: 'abcde',
|
||||
enabled: true,
|
||||
teamIds: '',
|
||||
allowedOrganizations: '',
|
||||
allowedDomains: '',
|
||||
allowedGroups: '',
|
||||
scopes: '',
|
||||
orgMapping: '',
|
||||
teamIds: '[]',
|
||||
allowedOrganizations: '[]',
|
||||
allowedDomains: '[]',
|
||||
allowedGroups: '[]',
|
||||
scopes: '[]',
|
||||
orgMapping: '[]',
|
||||
},
|
||||
};
|
||||
|
||||
@ -147,8 +147,8 @@ describe('ProviderConfigForm', () => {
|
||||
settings: {
|
||||
allowAssignGrafanaAdmin: false,
|
||||
allowSignUp: false,
|
||||
allowedDomains: 'grafana.com',
|
||||
allowedOrganizations: '',
|
||||
allowedDomains: '["grafana.com"]',
|
||||
allowedOrganizations: '[]',
|
||||
autoLogin: true,
|
||||
clientId: 'test-client-id',
|
||||
clientSecret: 'test-client-secret',
|
||||
@ -157,10 +157,10 @@ describe('ProviderConfigForm', () => {
|
||||
orgMapping: '["Group A:1:Editor","Group B:2:Admin"]',
|
||||
roleAttributePath: 'new-attribute-path',
|
||||
roleAttributeStrict: true,
|
||||
scopes: 'user:email',
|
||||
scopes: '["user:email"]',
|
||||
signoutRedirectUrl: '',
|
||||
skipOrgRoleSync: false,
|
||||
teamIds: '',
|
||||
teamIds: '[]',
|
||||
tlsClientCa: '',
|
||||
tlsClientCert: '',
|
||||
tlsClientKey: '',
|
||||
@ -197,8 +197,8 @@ describe('ProviderConfigForm', () => {
|
||||
settings: {
|
||||
allowAssignGrafanaAdmin: false,
|
||||
allowSignUp: false,
|
||||
allowedDomains: '',
|
||||
allowedOrganizations: '',
|
||||
allowedDomains: '[]',
|
||||
allowedOrganizations: '[]',
|
||||
autoLogin: true,
|
||||
clientId: 'test-client-id',
|
||||
clientSecret: 'test-client-secret',
|
||||
@ -206,16 +206,16 @@ describe('ProviderConfigForm', () => {
|
||||
name: 'GitHub',
|
||||
roleAttributePath: '',
|
||||
roleAttributeStrict: false,
|
||||
scopes: 'user:email',
|
||||
scopes: '["user:email"]',
|
||||
signoutRedirectUrl: '',
|
||||
skipOrgRoleSync: false,
|
||||
teamIds: '',
|
||||
teamIds: '[]',
|
||||
tlsClientCa: '',
|
||||
tlsClientCert: '',
|
||||
tlsClientKey: '',
|
||||
usePkce: false,
|
||||
useRefreshToken: false,
|
||||
orgMapping: '',
|
||||
orgMapping: '[]',
|
||||
},
|
||||
},
|
||||
{ showErrorAlert: false }
|
||||
|
@ -78,10 +78,7 @@ export function dataToDTO(data?: SSOProvider): SSOProviderDTO {
|
||||
}
|
||||
|
||||
const valuesToString = (values: Array<SelectableValue<string>>) => {
|
||||
if (values.length <= 1) {
|
||||
return values.map(({ value }) => value).join(',');
|
||||
}
|
||||
// Store as JSON array if there are multiple values
|
||||
// Store arrays as JSON array
|
||||
return JSON.stringify(values.map(({ value }) => value));
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user