feat: restrict certain endpoints from API tokens and/or read-only tokens
This commit is contained in:
parent
2716471fa9
commit
ff75075b81
13 changed files with 62 additions and 14 deletions
|
@ -28,6 +28,10 @@ func (s *Server) patchUser(w http.ResponseWriter, r *http.Request) error {
|
|||
|
||||
claims, _ := server.ClaimsFromContext(ctx)
|
||||
|
||||
if !claims.TokenWrite {
|
||||
return server.APIError{Code: server.ErrMissingPermissions, Details: "This token is read-only"}
|
||||
}
|
||||
|
||||
var req PatchUserRequest
|
||||
err := render.Decode(r, &req)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue