diff --git a/services/web/app/src/Features/UserMembership/UserMembershipController.js b/services/web/app/src/Features/UserMembership/UserMembershipController.js index 456f14ad13..4c00a66723 100644 --- a/services/web/app/src/Features/UserMembership/UserMembershipController.js +++ b/services/web/app/src/Features/UserMembership/UserMembershipController.js @@ -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) diff --git a/services/web/test/unit/src/UserMembership/UserMembershipControllerTests.js b/services/web/test/unit/src/UserMembership/UserMembershipControllerTests.js index 0150dcb75f..69840dc262 100644 --- a/services/web/test/unit/src/UserMembership/UserMembershipControllerTests.js +++ b/services/web/test/unit/src/UserMembership/UserMembershipControllerTests.js @@ -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 }, }, } ))