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 { csvAttachment } = require('../../infrastructure/Response')
const { UserIsManagerError } = require('./UserMembershipErrors')
const { SSOConfig } = require('../../models/SSOConfig')
const CSVParser = require('json2csv').Parser
const SSOConfigManager = require('../../../../modules/managed-users/app/src/SSOConfigManager')
async function manageGroupMembers(req, res, next) {
const { entity, entityConfig } = req
const ssoConfig = await SSOConfigManager.promises.getSSOConfig(
entity.ssoConfig
)
const ssoConfig = await SSOConfig.findById(entity.ssoConfig).exec()
return entity.fetchV1Data(function (error, entity) {
if (error != null) {
return next(error)

View file

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