mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #2991 from overleaf/msm-add-user-projection-project-controller
Added projection to User.getById() in ProjectController GitOrigin-RevId: 9233a897414e3cda0b8c91f0b50d4ac422e0ab30
This commit is contained in:
parent
6562f3003d
commit
e692802690
2 changed files with 14 additions and 10 deletions
|
@ -646,16 +646,20 @@ const ProjectController = {
|
|||
if (userId == null) {
|
||||
cb(null, defaultSettingsForAnonymousUser(userId))
|
||||
} else {
|
||||
User.findById(userId, (err, user) => {
|
||||
// Handle case of deleted user
|
||||
if (user == null) {
|
||||
UserController.logout(req, res, next)
|
||||
return
|
||||
}
|
||||
User.findById(
|
||||
userId,
|
||||
'email first_name last_name referal_id signUpDate featureSwitches features refProviders alphaProgram betaProgram isAdmin ace',
|
||||
(err, user) => {
|
||||
// Handle case of deleted user
|
||||
if (user == null) {
|
||||
UserController.logout(req, res, next)
|
||||
return
|
||||
}
|
||||
|
||||
logger.log({ projectId, userId }, 'got user')
|
||||
cb(err, user)
|
||||
})
|
||||
logger.log({ projectId, userId }, 'got user')
|
||||
cb(err, user)
|
||||
}
|
||||
)
|
||||
}
|
||||
},
|
||||
subscription(cb) {
|
||||
|
|
|
@ -937,7 +937,7 @@ describe('ProjectController', function() {
|
|||
email: 'bob@bob.com'
|
||||
}
|
||||
this.ProjectGetter.getProject.callsArgWith(2, null, this.project)
|
||||
this.UserModel.findById.callsArgWith(1, null, this.user)
|
||||
this.UserModel.findById.callsArgWith(2, null, this.user)
|
||||
this.SubscriptionLocator.getUsersSubscription.callsArgWith(1, null, {})
|
||||
this.AuthorizationManager.getPrivilegeLevelForProject.callsArgWith(
|
||||
3,
|
||||
|
|
Loading…
Reference in a new issue