Added error when nonleader attempts to invite to group plan (#8331)

This commit is contained in:
Keith Holliday
2016-12-30 13:17:22 -06:00
committed by GitHub
parent c8b61a2f7d
commit 97e40c81f3
3 changed files with 24 additions and 1 deletions

View File

@@ -893,6 +893,8 @@ api.inviteToGroup = {
let group = await Group.getGroup({user, groupId: req.params.groupId, fields: '-chat'});
if (!group) throw new NotFound(res.t('groupNotFound'));
if (group.purchased && group.purchased.plan.customerId && user._id !== group.leader) throw new NotAuthorized(res.t('onlyGroupLeaderCanInviteToGroupPlan'));
let uuids = req.body.uuids;
let emails = req.body.emails;