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)
| 114 | // triggering a user access change, this happens at write time (via MarkPrincipalsChanged), and doesn't |
| 115 | // depend on the userChangeWaiter. |
| 116 | func 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 | |
| 128 | func (bh *blipHandler) refreshUser() error { |
| 129 |
no test coverage detected