Further scaffolding

This commit is contained in:
Shane Kilkelly 2016-07-20 15:22:48 +01:00
parent a4c7db5f20
commit 5b22be8a0b
3 changed files with 17 additions and 6 deletions

View file

@ -15,7 +15,7 @@ module.exports = CollaboratorsInviteController =
LimitationsManager.canAddXCollaborators project_id, 1, (error, allowed) =>
return next(error) if error?
if !allowed
logger.log {projectId, email, sendingUserId}, "not allowed to invite any more users to this project"
logger.log {projectId, email, sendingUserId}, "not allowed to invite more users to project"
return res.json {}
{email, privileges} = req.body
email = mimelib.parseAddresses(email or "")[0]?.address?.toLowerCase()
@ -30,7 +30,18 @@ module.exports = CollaboratorsInviteController =
return res.json {inviteId: invite._id}
revokeInvite: (req, res, next) ->
projectId = req.params.Project_id
inviteId = req.params.invite_id
logger.log {projectId, inviteId}, "revoking invite"
CollaboratorsInviteHandler.revokeInvite projectId, inviteId, (err) ->
if err?
logger.err {projectId, inviteId}, "error revoking invite"
return next(err)
res.status(201).send()
viewInvite: (req, res, next) ->
projectId = req.params.Project_id
token = req.params.token
acceptInvite: (req, res, next) ->

View file

@ -1,9 +1,9 @@
module.experts = CollaboratorsInviteHandler =
inviteToProject: (callback) ->
inviteToProject: (projectId, sendingUserId, email, priveleges, callback=(err,invite)->) ->
revokeInvite: (callback) ->
revokeInvite: (projectId, inviteId, callback=(err)->) ->
viewInvite: (callback) ->
getInviteByToken: (projectId, tokenString, callback=(err,invite)->) ->
acceptInvite: (callback) ->
acceptInvite: (projectId, inviteId, callback=(err)->) ->

View file

@ -24,7 +24,7 @@ module.exports =
)
webRouter.get(
'/project/:Project_id/invite/token/:token_id',
'/project/:Project_id/invite/token/:token',
CollaboratorsInviteController.viewInvite
)