[FIX][ENTERPRISE] OAuth "Merge Roles" removes roles from users (#23588)
* Fix OAuth 'Merge Roles' * Add setting to control which roles to sync Co-authored-by: pierre-lehnen-rc <55164754+pierre-lehnen-rc@users.noreply.github.com>pull/23675/head^2
parent
4c9c2e657f
commit
34cb351a15
@ -0,0 +1,27 @@ |
||||
import { settings, settingsRegistry } from '../../../app/settings/server'; |
||||
import { addMigration } from '../../lib/migrations'; |
||||
|
||||
addMigration({ |
||||
version: 247, |
||||
up() { |
||||
const customOauthServices = settings.getByRegexp(/Accounts_OAuth_Custom-[^-]+$/mi); |
||||
const serviceNames = customOauthServices.map(([key]) => key.replace('Accounts_OAuth_Custom-', '')); |
||||
|
||||
serviceNames.forEach((serviceName) => { |
||||
settingsRegistry.add(`Accounts_OAuth_Custom-${ serviceName }-roles_to_sync`, '', { |
||||
type: 'string', |
||||
group: 'OAuth', |
||||
section: `Custom OAuth: ${ serviceName }`, |
||||
i18nLabel: 'Accounts_OAuth_Custom_Roles_To_Sync', |
||||
i18nDescription: 'Accounts_OAuth_Custom_Roles_To_Sync_Description', |
||||
enterprise: true, |
||||
enableQuery: { |
||||
_id: `Accounts_OAuth_Custom-${ serviceName }-merge_roles`, |
||||
value: true, |
||||
}, |
||||
invalidValue: '', |
||||
modules: ['oauth-enterprise'], |
||||
}); |
||||
}); |
||||
}, |
||||
}); |
||||
Loading…
Reference in new issue