Merge pull request #17030 from overleaf/ab-fix-sso-enable-clearing-attributes

[web] Fix SSO config update when enabling and block enabling unvalidated config

GitOrigin-RevId: 27b043117d5599d327e2322acd3901fc7286ab6b
This commit is contained in:
Alexandre Bourdin 2024-02-13 14:22:53 +01:00 committed by Copybot
parent 7c681dc88a
commit b662b0742f

View file

@ -91,6 +91,21 @@ class Subscription {
) )
} }
setValidatedSSO(callback) {
db.subscriptions.findOne({ _id: new ObjectId(this._id) }, (error, doc) => {
if (error) {
return callback(error)
}
const ssoConfigId = doc.ssoConfig
db.ssoConfigs.findOneAndUpdate(
{ _id: ssoConfigId },
{ $set: { validated: true } },
callback
)
})
}
setValidatedAndEnabledSSO(callback) { setValidatedAndEnabledSSO(callback) {
db.subscriptions.findOne({ _id: new ObjectId(this._id) }, (error, doc) => { db.subscriptions.findOne({ _id: new ObjectId(this._id) }, (error, doc) => {
if (error) { if (error) {