2018-10-24 09:50:34 -04:00
|
|
|
UserMembershipAuthorization = require './UserMembershipAuthorization'
|
2018-09-25 09:10:06 -04:00
|
|
|
UserMembershipController = require './UserMembershipController'
|
|
|
|
|
|
|
|
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-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
|