forked from RocketChat/Rocket.Chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add custom OAuth setting to allow merging users to others from …
…distinct services (RocketChat#28783) * Merge OAuth users with existing users from distinct services when setting is enabled * Add changesets * Fix changesets * Apply requested changes --------- Co-authored-by: Diego Sampaio <chinello@gmail.com> Co-authored-by: Rafael Tapia <rafael.tapia@rocket.chat> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Gabriel Casals <83978645+casalsgh@users.noreply.github.com>
- Loading branch information
1 parent
eecd9fc
commit 74aa677
Showing
7 changed files
with
58 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@rocket.chat/meteor": minor | ||
"@rocket.chat/rest-typings": minor | ||
--- | ||
|
||
feat: Add custom OAuth setting to allow merging users to others from distinct services |
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,27 @@ | ||
import { Settings } from '@rocket.chat/models'; | ||
|
||
import { settingsRegistry } from '../../../app/settings/server'; | ||
import { addMigration } from '../../lib/migrations'; | ||
|
||
addMigration({ | ||
version: 300, | ||
async up() { | ||
const customOauthServices = await Settings.find({ _id: /Accounts_OAuth_Custom-[^-]+$/ }, { projection: { _id: 1 } }).toArray(); | ||
const serviceNames = customOauthServices.map(({ _id }) => _id.replace('Accounts_OAuth_Custom-', '')); | ||
|
||
for await (const serviceName of serviceNames) { | ||
await settingsRegistry.add(`Accounts_OAuth_Custom-${serviceName}-merge_users_distinct_services`, false, { | ||
type: 'boolean', | ||
group: 'OAuth', | ||
section: `Custom OAuth: ${serviceName}`, | ||
i18nLabel: 'Accounts_OAuth_Custom_Merge_Users_Distinct_Services', | ||
i18nDescription: 'Accounts_OAuth_Custom_Merge_Users_Distinct_Services_Description', | ||
enableQuery: { | ||
_id: `Accounts_OAuth_Custom-${serviceName}-merge_users`, | ||
value: true, | ||
}, | ||
persistent: true, | ||
}); | ||
} | ||
}, | ||
}); |
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