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

Function MakeUserCtx

db/crud.go:3357–3370  ·  view source on GitHub ↗
(user auth.User, scopeName string, collectionName string)

Source from the content-addressed store, hash-verified

3355}
3356
3357func MakeUserCtx(user auth.User, scopeName string, collectionName string) (map[string]any, error) {
3358 if user == nil {
3359 return nil, nil
3360 }
3361 channels, err := user.InheritedCollectionChannels(scopeName, collectionName)
3362 if err != nil {
3363 return nil, err
3364 }
3365 return map[string]interface{}{
3366 "name": user.Name(),
3367 "roles": user.RoleNames(),
3368 "channels": channels.AllKeys(),
3369 }, nil
3370}
3371
3372// Are the principal and role names in an AccessMap all valid?
3373func validateAccessMap(ctx context.Context, access channels.AccessMap) bool {

Callers 3

RunMethod · 0.92
SyncFnDryRunMethod · 0.85
getChannelsAndAccessMethod · 0.85

Calls 4

AllKeysMethod · 0.80
NameMethod · 0.65
RoleNamesMethod · 0.65

Tested by

no test coverage detected