mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Merge pull request #1062 from sharelatex/ta-metric-authorization
Use UserMembership Authorization Middlewear for Metrics GitOrigin-RevId: a145527723539696c2659baa16c507ab54f629a3
This commit is contained in:
committed by
sharelatex
parent
edd832b1f2
commit
aff47a4b11
@@ -6,13 +6,13 @@ Errors = require('../Errors/Errors')
|
||||
logger = require("logger-sharelatex")
|
||||
|
||||
module.exports =
|
||||
requireEntityAccess: (entityName) ->
|
||||
requireEntityAccess: (entityName, entityId = null) ->
|
||||
(req, res, next) ->
|
||||
loggedInUser = AuthenticationController.getSessionUser(req)
|
||||
unless loggedInUser
|
||||
return AuthorizationMiddlewear.redirectToRestricted req, res, next
|
||||
|
||||
entityId = req.params.id
|
||||
entityId = req.params.id unless entityId?
|
||||
getEntity entityName, entityId, loggedInUser, (error, entity, entityConfig) ->
|
||||
return next(error) if error?
|
||||
unless entity?
|
||||
|
||||
@@ -19,6 +19,14 @@ module.exports =
|
||||
removeInvite: '/subscription/invites'
|
||||
exportMembers: '/subscription/group/export'
|
||||
|
||||
team: # for metrics only
|
||||
modelName: 'Subscription'
|
||||
fields:
|
||||
primaryKey: 'overleaf.id'
|
||||
access: 'manager_ids'
|
||||
baseQuery:
|
||||
groupPlan: true
|
||||
|
||||
groupManagers:
|
||||
modelName: 'Subscription'
|
||||
fields:
|
||||
|
||||
Reference in New Issue
Block a user