Merge pull request #15504 from overleaf/msm-fix-import-sp

[web] Replace module import breaking Server Pro

GitOrigin-RevId: 23f65b06d14019d1878c61abdf71b6b556192dc4
This commit is contained in:
Miguel Serrano 2023-10-31 13:25:12 +01:00 committed by Copybot
parent cb33f70377
commit 220998839b
2 changed files with 7 additions and 10 deletions

View file

@ -16,15 +16,13 @@ const Errors = require('../Errors/Errors')
const EmailHelper = require('../Helpers/EmailHelper') const EmailHelper = require('../Helpers/EmailHelper')
const { csvAttachment } = require('../../infrastructure/Response') const { csvAttachment } = require('../../infrastructure/Response')
const { UserIsManagerError } = require('./UserMembershipErrors') const { UserIsManagerError } = require('./UserMembershipErrors')
const { SSOConfig } = require('../../models/SSOConfig')
const CSVParser = require('json2csv').Parser const CSVParser = require('json2csv').Parser
const SSOConfigManager = require('../../../../modules/managed-users/app/src/SSOConfigManager')
async function manageGroupMembers(req, res, next) { async function manageGroupMembers(req, res, next) {
const { entity, entityConfig } = req const { entity, entityConfig } = req
const ssoConfig = await SSOConfigManager.promises.getSSOConfig( const ssoConfig = await SSOConfig.findById(entity.ssoConfig).exec()
entity.ssoConfig
)
return entity.fetchV1Data(function (error, entity) { return entity.fetchV1Data(function (error, entity) {
if (error != null) { if (error != null) {
return next(error) return next(error)

View file

@ -69,10 +69,10 @@ describe('UserMembershipController', function () {
getSessionUser: sinon.stub().returns(this.user), getSessionUser: sinon.stub().returns(this.user),
getLoggedInUserId: sinon.stub().returns(this.user._id), getLoggedInUserId: sinon.stub().returns(this.user._id),
} }
this.SSOConfigManager = { this.SSOConfig = {
promises: { findById: sinon
getSSOConfig: sinon.stub().resolves({ enabled: true }), .stub()
}, .returns({ exec: sinon.stub().resolves({ enabled: true }) }),
} }
this.UserMembershipHandler = { this.UserMembershipHandler = {
getEntity: sinon.stub().yields(null, this.subscription), getEntity: sinon.stub().yields(null, this.subscription),
@ -96,8 +96,7 @@ describe('UserMembershipController', function () {
'../SplitTests/SplitTestHandler': this.SplitTestHandler, '../SplitTests/SplitTestHandler': this.SplitTestHandler,
'./UserMembershipHandler': this.UserMembershipHandler, './UserMembershipHandler': this.UserMembershipHandler,
'@overleaf/settings': this.Settings, '@overleaf/settings': this.Settings,
'../../../../modules/managed-users/app/src/SSOConfigManager': '../../models/SSOConfig': { SSOConfig: this.SSOConfig },
this.SSOConfigManager,
}, },
} }
)) ))