mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Merge pull request #13933 from overleaf/bg-managed-users-add-missing-jsdoc-param
refactor getUserValidationStatus in PermissionsManager GitOrigin-RevId: 80ef8142d3556e47e1d6cb323148f1f1042057aa
This commit is contained in:
@@ -282,17 +282,19 @@ function hasPermission(groupPolicy, capability) {
|
||||
|
||||
/**
|
||||
* Asynchronously checks which policies a user complies with using the
|
||||
* applicable validators. Each validator is an async function that takes a object
|
||||
* with user and subscription properties and returns a boolean.
|
||||
* applicable validators. Each validator is an async function that takes an object
|
||||
* with user, groupPolicy, and subscription properties and returns a boolean.
|
||||
*
|
||||
* @param {Object} user - The user object to check.
|
||||
* @param {Object} groupPolicy - The group policy object to check.
|
||||
* @param {Object} options - The options object.
|
||||
* @param {Object} options.user - The user object to check.
|
||||
* @param {Object} options.groupPolicy - The group policy object to check.
|
||||
* @param {Object} options.subscription - The subscription object for the group policy.
|
||||
* @returns {Promise<Map>} A promise that resolves with a Map object containing
|
||||
* the validation status for each enforced policy. The keys of the Map are the
|
||||
* enforced policy names, and the values are booleans indicating whether the
|
||||
* user complies with the policy.
|
||||
*/
|
||||
async function getUserValidationStatus(user, groupPolicy, subscription) {
|
||||
async function getUserValidationStatus({ user, groupPolicy, subscription }) {
|
||||
// find all the enforced policies for the user
|
||||
const enforcedPolicyNames = getEnforcedPolicyNames(groupPolicy)
|
||||
// for each enforced policy, we have a list of capabilities with expected values
|
||||
|
||||
@@ -93,11 +93,11 @@ async function viewInvite(req, res, next) {
|
||||
}
|
||||
|
||||
validationStatus =
|
||||
await PermissionsManager.promises.getUserValidationStatus(
|
||||
await PermissionsManager.promises.getUserValidationStatus({
|
||||
user,
|
||||
subscription.groupPolicy,
|
||||
subscription
|
||||
)
|
||||
groupPolicy: subscription.groupPolicy,
|
||||
subscription,
|
||||
})
|
||||
|
||||
return res.render('subscriptions/team/invite-managed', {
|
||||
inviterName: invite.inviterName,
|
||||
|
||||
Reference in New Issue
Block a user