MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / handleGetAllChannels

Method handleGetAllChannels

rest/diagnostic_api.go:198–220  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

196}
197
198func (h *handler) handleGetAllChannels() error {
199 h.assertAdminOnly()
200 user, err := h.db.Authenticator(h.ctx()).GetUser(internalUserName(mux.Vars(h.rq)["name"]))
201 if err != nil {
202 return fmt.Errorf("could not get user %s: %w", user.Name(), err)
203 }
204 if user == nil {
205 return kNotFoundError
206 }
207
208 resp, err := h.getAllUserChannelsResponse(user)
209 if err != nil {
210 return err
211 }
212 allChannels := allChannels{Channels: resp}
213
214 bytes, err := base.JSONMarshal(allChannels)
215 if err != nil {
216 return err
217 }
218 h.writeRawJSON(bytes)
219 return err
220}
221
222func (h *handler) handleGetUserDocAccessSpan() error {
223 h.assertAdminOnly()

Callers

nothing calls this directly

Calls 10

assertAdminOnlyMethod · 0.95
ctxMethod · 0.95
writeRawJSONMethod · 0.95
JSONMarshalFunction · 0.92
internalUserNameFunction · 0.85
GetUserMethod · 0.80
ErrorfMethod · 0.80
NameMethod · 0.65
AuthenticatorMethod · 0.45

Tested by

no test coverage detected