mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 18:43:10 -06:00
HNT-105 invite authz
This commit is contained in:
parent
94061b7b8d
commit
36039c2efc
|
|
@ -353,6 +353,19 @@ func Setup(
|
||||||
return util.ErrorResponse(err)
|
return util.ErrorResponse(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isAllowedInviter, _ := authorization.IsAllowed(authz.AuthorizationArgs{
|
||||||
|
RoomId: vars["roomID"],
|
||||||
|
UserId: device.UserID,
|
||||||
|
Permission: authz.PermissionInvite,
|
||||||
|
})
|
||||||
|
|
||||||
|
if !isAllowedInviter {
|
||||||
|
return util.JSONResponse{
|
||||||
|
Code: http.StatusUnauthorized,
|
||||||
|
JSON: jsonerror.Forbidden("Inviter not allowed"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return SendInvite(req, userAPI, device, vars["roomID"], cfg, rsAPI, asAPI)
|
return SendInvite(req, userAPI, device, vars["roomID"], cfg, rsAPI, asAPI)
|
||||||
}),
|
}),
|
||||||
).Methods(http.MethodPost, http.MethodOptions)
|
).Methods(http.MethodPost, http.MethodOptions)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue