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

Function userBlipHandler

db/blip_handler.go:116–126  ·  view source on GitHub ↗

userBlipHandler wraps another blip handler with code that reloads the user object when the user or the user's roles have changed, to make sure that the replication has the latest channel access grants. Uses a userChangeWaiter to detect changes to the user or roles. Note that in the case of a pushed

(next blipHandlerFunc)

Source from the content-addressed store, hash-verified

114// triggering a user access change, this happens at write time (via MarkPrincipalsChanged), and doesn't
115// depend on the userChangeWaiter.
116func userBlipHandler(next blipHandlerFunc) blipHandlerFunc {
117 return func(bh *blipHandler, bm *blip.Message) error {
118
119 // Reload user if it has changed
120 if err := bh.refreshUser(); err != nil {
121 return err
122 }
123 // Call down to the underlying handler and return it's value
124 return next(bh, bm)
125 }
126}
127
128func (bh *blipHandler) refreshUser() error {
129

Callers 1

blip_handler.goFile · 0.85

Calls 1

refreshUserMethod · 0.80

Tested by

no test coverage detected