feat: set groups based on OIDC claim (#5568)
Co-authored-by: Nicolas Giard <github@ngpixel.com>
This commit is contained in:
@@ -29,6 +29,17 @@ module.exports = {
|
||||
email: _.get(profile, '_json.' + conf.emailClaim)
|
||||
}
|
||||
})
|
||||
if (conf.mapGroups) {
|
||||
const groups = _.get(profile, '_json.' + conf.groupsClaim)
|
||||
if (groups) {
|
||||
const groupIDs = Object.values(WIKI.auth.groups)
|
||||
.filter(g => groups.includes(g.name))
|
||||
.map(g => g.id)
|
||||
for (let groupID of groupIDs) {
|
||||
await user.$relatedQuery('groups').relate(groupID)
|
||||
}
|
||||
}
|
||||
}
|
||||
cb(null, user)
|
||||
} catch (err) {
|
||||
cb(err, null)
|
||||
|
Reference in New Issue
Block a user