Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -9969,6 +9969,13 @@ func HandleApiGeneration(resp http.ResponseWriter, request *http.Request) {
return
}

if foundUser.Id != userInfo.Id {
log.Printf("[AUDIT] %s tried and failed to change apikey for %s (1)", userInfo.Username, t.UserId)
resp.WriteHeader(401)
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Can't change the apikey of another user"}`)))
return
}

// FIXME: May not be good due to different roles in different organizations.
if foundUser.Role == "admin" {
log.Printf("[AUDIT] %s tried and failed to change apikey for %s. Skipping because users' role is admin", userInfo.Username, t.UserId)
Expand Down
Loading