fix: Disable 'Invite people…' control for non-admins (#1903)

closes #1902
This commit is contained in:
Tom Moor
2021-02-18 23:35:55 -08:00
committed by GitHub
parent fae54c7957
commit bbf434e2f4
4 changed files with 46 additions and 29 deletions

View File

@@ -195,8 +195,9 @@ router.post("users.invite", auth(), async (ctx) => {
const { invites } = ctx.body;
ctx.assertPresent(invites, "invites is required");
const user = ctx.state.user;
authorize(user, "invite", User);
const { user } = ctx.state;
const team = await Team.findByPk(user.teamId);
authorize(user, "invite", team);
const response = await userInviter({ user, invites, ip: ctx.request.ip });