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
|
@ -12,8 +12,8 @@ func (s *Server) deleteUser(w http.ResponseWriter, r *http.Request) error {
|
|||
ctx := r.Context()
|
||||
claims, _ := server.ClaimsFromContext(ctx)
|
||||
|
||||
if claims.APIToken || !claims.TokenWrite {
|
||||
return server.APIError{Code: server.ErrMissingPermissions}
|
||||
if claims.APIToken {
|
||||
return server.APIError{Code: server.ErrMissingPermissions, Details: "This endpoint cannot be used by API tokens"}
|
||||
}
|
||||
|
||||
tx, err := s.DB.Begin(ctx)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue