AddBucketUserLogContext adds bucket user to the parent context for logging. This is used to mark actions not caused by a user.
(ctx context.Context)
| 2171 | |
| 2172 | // AddBucketUserLogContext adds bucket user to the parent context for logging. This is used to mark actions not caused by a user. |
| 2173 | func (dbCtx *DatabaseContext) AddBucketUserLogContext(ctx context.Context) context.Context { |
| 2174 | spec := dbCtx.BucketSpec |
| 2175 | // Server is empty in testing only |
| 2176 | if spec.Server == "" || spec.IsWalrusBucket() { |
| 2177 | return base.UserLogCtx(ctx, "rosmar_noauth", base.UserDomainBuiltin, nil) |
| 2178 | } |
| 2179 | username, _, _ := dbCtx.BucketSpec.Auth.GetCredentials() |
| 2180 | return base.UserLogCtx(ctx, username, base.UserDomainBuiltin, nil) |
| 2181 | |
| 2182 | } |
| 2183 | |
| 2184 | // onlyDefaultCollection is true if the database is only configured with default collection. |
| 2185 | func (dbCtx *DatabaseContext) OnlyDefaultCollection() bool { |
no test coverage detected