mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #16082 from overleaf/jel-group-sso-already-linked
[web] Fix projection when checking if user is already enrolled in SSO GitOrigin-RevId: eebe645cba2f911783f1b2a636a4fc51a8f6107b
This commit is contained in:
parent
e57806b204
commit
8a741b89f2
1 changed files with 1 additions and 4 deletions
|
@ -18,10 +18,7 @@ async function checkUserCanEnrollInSubscription(userId, subscription) {
|
||||||
throw new Errors.SAMLGroupSSOLoginIdentityNotFoundError()
|
throw new Errors.SAMLGroupSSOLoginIdentityNotFoundError()
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = await User.findOne(
|
const user = await User.findOne({ _id: userId }, { enrollment: 1 }).exec()
|
||||||
{ _id: userId },
|
|
||||||
{ projection: { enrollment: 1 } }
|
|
||||||
).exec()
|
|
||||||
|
|
||||||
const userIsEnrolled = user.enrollment?.sso?.some(
|
const userIsEnrolled = user.enrollment?.sso?.some(
|
||||||
enrollment => enrollment.groupId.toString() === subscription._id.toString()
|
enrollment => enrollment.groupId.toString() === subscription._id.toString()
|
||||||
|
|
Loading…
Reference in a new issue