mirror of
https://github.com/boringproxy/boringproxy.git
synced 2025-02-25 18:55:29 -06:00
Check client when creating client on api
This commit is contained in:
parent
6f12fc2633
commit
0b9a175ce9
8
api.go
8
api.go
@ -175,8 +175,16 @@ func (a *Api) handleUsers(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
} else if len(parts) == 3 && parts[1] == "clients" {
|
||||
|
||||
ownerId := parts[0]
|
||||
clientId := parts[2]
|
||||
|
||||
if tokenData.Client != "" && clientId != tokenData.Client {
|
||||
w.WriteHeader(403)
|
||||
io.WriteString(w, "Token cannot be used to modify this user's clients")
|
||||
return
|
||||
}
|
||||
|
||||
if r.Method == "PUT" {
|
||||
err := a.SetClient(tokenData, r.Form, ownerId, clientId)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user