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

Method addValueForUser

channels/sync_runner.go:225–233  ·  view source on GitHub ↗

Common implementation of 'access()' and 'role()' callbacks

(ctx context.Context, user otto.Value, value otto.Value, mapping map[string][]string)

Source from the content-addressed store, hash-verified

223
224// Common implementation of 'access()' and 'role()' callbacks
225func (runner *SyncRunner) addValueForUser(ctx context.Context, user otto.Value, value otto.Value, mapping map[string][]string) otto.Value {
226 valueStrings := ottoValueToStringArray(ctx, value)
227 if len(valueStrings) > 0 {
228 for _, name := range ottoValueToStringArray(ctx, user) {
229 mapping[name] = append(mapping[name], valueStrings...)
230 }
231 }
232 return otto.UndefinedValue()
233}
234
235func compileAccessMap(input map[string][]string, prefix string) (AccessMap, error) {
236 access := make(AccessMap, len(input))

Callers 1

NewSyncRunnerWithLoggingFunction · 0.95

Calls 1

ottoValueToStringArrayFunction · 0.85

Tested by

no test coverage detected