MCPcopy Create free account
hub / github.com/boringproxy/boringproxy / SetClient

Method SetClient

api.go:594–609  ·  view source on GitHub ↗
(tokenData TokenData, params url.Values, ownerId, clientId string)

Source from the content-addressed store, hash-verified

592}
593
594func (a *Api) SetClient(tokenData TokenData, params url.Values, ownerId, clientId string) error {
595
596 if tokenData.Owner != ownerId {
597 user, _ := a.db.GetUser(tokenData.Owner)
598 if !user.IsAdmin {
599 return errors.New("Unauthorized")
600 }
601 }
602
603 // TODO: what if two users try to get then set at the same time?
604 owner, _ := a.db.GetUser(ownerId)
605 owner.Clients[clientId] = DbClient{}
606 a.db.SetUser(ownerId, owner)
607
608 return nil
609}
610
611func (a *Api) DeleteClient(tokenData TokenData, ownerId, clientId string) error {
612

Callers 2

handleClientsMethod · 0.95
handleClientsMethod · 0.80

Calls 2

GetUserMethod · 0.80
SetUserMethod · 0.80

Tested by

no test coverage detected