mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
b123f830ff
User Membership Access Refactor GitOrigin-RevId: 23e8d342bc4829450625146213ff92cb042550dd
26 lines
957 B
CoffeeScript
26 lines
957 B
CoffeeScript
UserMembershipAuthorization = require './UserMembershipAuthorization'
|
|
UserMembershipController = require './UserMembershipController'
|
|
|
|
module.exports =
|
|
apply: (webRouter) ->
|
|
webRouter.get '/manage/groups/:id/members',
|
|
UserMembershipAuthorization.requireEntityAccess('group'),
|
|
UserMembershipController.index
|
|
|
|
|
|
regularEntitites =
|
|
groups: 'groupManagers'
|
|
institutions: 'institution'
|
|
for pathName, entityName of regularEntitites
|
|
do (pathName, entityName) ->
|
|
webRouter.get "/manage/#{pathName}/:id/managers",
|
|
UserMembershipAuthorization.requireEntityAccess(entityName),
|
|
UserMembershipController.index
|
|
|
|
webRouter.post "/manage/#{pathName}/:id/managers",
|
|
UserMembershipAuthorization.requireEntityAccess(entityName),
|
|
UserMembershipController.add
|
|
|
|
webRouter.delete "/manage/#{pathName}/:id/managers/:userId",
|
|
UserMembershipAuthorization.requireEntityAccess(entityName),
|
|
UserMembershipController.remove
|