Recomputes the set of channels a User/Role has been granted access to by sync() functions for a single collection.
(ctx context.Context, user auth.User)
| 3451 | |
| 3452 | // Recomputes the set of channels a User/Role has been granted access to by sync() functions for a single collection. |
| 3453 | func (c *DatabaseCollection) ComputeRolesForUser(ctx context.Context, user auth.User) (channels.TimedSet, error) { |
| 3454 | results, err := c.QueryRoleAccess(ctx, user.Name()) |
| 3455 | if err != nil { |
| 3456 | return nil, err |
| 3457 | } |
| 3458 | |
| 3459 | // Merge the TimedSets from the view result: |
| 3460 | roleChannelSet := channels.TimedSet{} |
| 3461 | var roleAccessRow QueryAccessRow |
| 3462 | for results.Next(ctx, &roleAccessRow) { |
| 3463 | roleChannelSet.Add(roleAccessRow.Value) |
| 3464 | } |
| 3465 | closeErr := results.Close() |
| 3466 | if closeErr != nil { |
| 3467 | return nil, closeErr |
| 3468 | } |
| 3469 | |
| 3470 | return roleChannelSet, nil |
| 3471 | } |
| 3472 | |
| 3473 | // Checks whether a document has a mobile xattr. Used when running in non-xattr mode to support no downtime upgrade. |
| 3474 | func (c *DatabaseCollection) checkForUpgrade(ctx context.Context, key string, unmarshalLevel DocumentUnmarshalLevel) (*Document, *sgbucket.BucketDocument) { |
nothing calls this directly
no test coverage detected