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

Method SetExplicitChannels

auth/principal.go:245–272  ·  view source on GitHub ↗

Helper function to set explicit channels for a collection

(scopeName, collectionName string, channels ...string)

Source from the content-addressed store, hash-verified

243
244// Helper function to set explicit channels for a collection
245func (u *PrincipalConfig) SetExplicitChannels(scopeName, collectionName string, channels ...string) {
246 channelSet := base.SetFromArray(channels)
247 if u.CollectionAccess == nil {
248 u.CollectionAccess = map[string]map[string]*CollectionAccessConfig{
249 scopeName: {
250 collectionName: {
251 ExplicitChannels_: channelSet,
252 },
253 },
254 }
255 return
256 }
257 if scope, ok := u.CollectionAccess[scopeName]; !ok {
258 u.CollectionAccess[scopeName] = map[string]*CollectionAccessConfig{
259 collectionName: {
260 ExplicitChannels_: channelSet,
261 },
262 }
263 } else {
264 if collection, ok := scope[collectionName]; !ok {
265 scope[collectionName] = &CollectionAccessConfig{
266 ExplicitChannels_: channelSet,
267 }
268 } else {
269 collection.ExplicitChannels_ = channelSet
270 }
271 }
272}
273
274func (u *PrincipalConfig) GetExplicitChannels(scopeName, collectionName string) base.Set {
275 if base.IsDefaultCollection(scopeName, collectionName) {

Callers 4

getUserPayloadMethod · 0.95
getPayloadMethod · 0.95
SetAdminChannelsMethod · 0.95

Calls 1

SetFromArrayFunction · 0.92

Tested by 3

getUserPayloadMethod · 0.76
getPayloadMethod · 0.76