2018-10-24 09:50:34 -04:00
|
|
|
UserMembershipAuthorization = require './UserMembershipAuthorization'
|
2018-09-25 09:10:06 -04:00
|
|
|
UserMembershipController = require './UserMembershipController'
|
2018-10-25 11:10:02 -04:00
|
|
|
SubscriptionGroupController = require '../Subscription/SubscriptionGroupController'
|
|
|
|
TeamInvitesController = require '../Subscription/TeamInvitesController'
|
2018-09-25 09:10:06 -04:00
|
|
|
|
|
|
|
module.exports =
|
|
|
|
apply: (webRouter) ->
|
2018-10-11 13:56:14 -04:00
|
|
|
webRouter.get '/manage/groups/:id/members',
|
2018-10-24 09:50:34 -04:00
|
|
|
UserMembershipAuthorization.requireEntityAccess('group'),
|
|
|
|
UserMembershipController.index
|
2018-10-25 11:10:02 -04:00
|
|
|
webRouter.post '/manage/groups/:id/invites',
|
|
|
|
UserMembershipAuthorization.requireEntityAccess('group'),
|
|
|
|
TeamInvitesController.createInvite
|
|
|
|
webRouter.delete '/manage/groups/:id/user/:user_id',
|
|
|
|
UserMembershipAuthorization.requireEntityAccess('group'),
|
|
|
|
SubscriptionGroupController.removeUserFromGroup
|
|
|
|
webRouter.delete '/manage/groups/:id/invites/:email',
|
|
|
|
UserMembershipAuthorization.requireEntityAccess('group'),
|
|
|
|
TeamInvitesController.revokeInvite
|
|
|
|
webRouter.get '/manage/groups/:id/members/export',
|
|
|
|
UserMembershipAuthorization.requireEntityAccess('group'),
|
|
|
|
UserMembershipController.exportCsv
|
2018-09-25 09:10:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
regularEntitites =
|
2018-10-11 13:56:14 -04:00
|
|
|
groups: 'groupManagers'
|
|
|
|
institutions: 'institution'
|
2018-09-25 09:10:06 -04:00
|
|
|
for pathName, entityName of regularEntitites
|
|
|
|
do (pathName, entityName) ->
|
2018-10-11 13:56:14 -04:00
|
|
|
webRouter.get "/manage/#{pathName}/:id/managers",
|
2018-10-24 09:50:34 -04:00
|
|
|
UserMembershipAuthorization.requireEntityAccess(entityName),
|
|
|
|
UserMembershipController.index
|
2018-09-25 09:10:06 -04:00
|
|
|
|
2018-10-11 13:56:14 -04:00
|
|
|
webRouter.post "/manage/#{pathName}/:id/managers",
|
2018-10-24 09:50:34 -04:00
|
|
|
UserMembershipAuthorization.requireEntityAccess(entityName),
|
|
|
|
UserMembershipController.add
|
2018-09-25 09:10:06 -04:00
|
|
|
|
2018-10-11 13:56:14 -04:00
|
|
|
webRouter.delete "/manage/#{pathName}/:id/managers/:userId",
|
2018-10-24 09:50:34 -04:00
|
|
|
UserMembershipAuthorization.requireEntityAccess(entityName),
|
|
|
|
UserMembershipController.remove
|