Add CollaboratorsInviteController and routes

This commit is contained in:
Shane Kilkelly 2016-07-20 14:04:14 +01:00
parent 13d6448ab8
commit e383e49161
3 changed files with 44 additions and 0 deletions

View file

@ -0,0 +1,11 @@
CollaboratorsInviteHandler = require('./CollaboratorsInviteHandler')
module.exports = CollaboratorsInviteController =
inviteToProject: (req, res) ->
revokeInvite: (req, res) ->
viewInvite: (req, res) ->
acceptInvite: (req, res) ->

View file

@ -0,0 +1,9 @@
module.experts = CollaboratorsInviteHandler =
inviteToProject: (callback) ->
revokeInvite: (callback) ->
viewInvite: (callback) ->
acceptInvite: (callback) ->

View file

@ -1,6 +1,7 @@
CollaboratorsController = require('./CollaboratorsController') CollaboratorsController = require('./CollaboratorsController')
AuthenticationController = require('../Authentication/AuthenticationController') AuthenticationController = require('../Authentication/AuthenticationController')
AuthorizationMiddlewear = require('../Authorization/AuthorizationMiddlewear') AuthorizationMiddlewear = require('../Authorization/AuthorizationMiddlewear')
CollaboratorsInviteController = require('./CollaboratorsInviteController')
module.exports = module.exports =
apply: (webRouter, apiRouter) -> apply: (webRouter, apiRouter) ->
@ -8,3 +9,26 @@ module.exports =
webRouter.post '/project/:Project_id/users', AuthorizationMiddlewear.ensureUserCanAdminProject, CollaboratorsController.addUserToProject webRouter.post '/project/:Project_id/users', AuthorizationMiddlewear.ensureUserCanAdminProject, CollaboratorsController.addUserToProject
webRouter.delete '/project/:Project_id/users/:user_id', AuthorizationMiddlewear.ensureUserCanAdminProject, CollaboratorsController.removeUserFromProject webRouter.delete '/project/:Project_id/users/:user_id', AuthorizationMiddlewear.ensureUserCanAdminProject, CollaboratorsController.removeUserFromProject
# invites
webRouter.post(
'/project/:Project_id/invite',
AuthorizationMiddlewear.ensureUserCanAdminProject,
CollaboratorsInviteController.inviteToProject
)
webRouter.delete(
'/project/:Project_id/invite/:invite_id',
AuthorizationMiddlewear.ensureUserCanAdminProject,
CollaboratorsInviteController.revokeInvite
)
webRouter.get(
'/project/:Project_id/invite/token/:token_id',
CollaboratorsInviteController.viewInvite
)
webRouter.post(
'/project/:Project_id/invite/:invite_id/accept',
CollaboratorsInviteController.acceptInvite
)