Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 24b29e2

Browse files
committed
add auth context to db call
1 parent c2bf9dc commit 24b29e2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

coderd/telemetry/telemetry.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"github.com/coder/coder/v2/buildinfo"
3030
clitelemetry "github.com/coder/coder/v2/cli/telemetry"
3131
"github.com/coder/coder/v2/coderd/database"
32+
"github.com/coder/coder/v2/coderd/database/dbauthz"
3233
"github.com/coder/coder/v2/coderd/database/dbtime"
3334
"github.com/coder/coder/v2/codersdk"
3435
tailnetproto "github.com/coder/coder/v2/tailnet/proto"
@@ -536,7 +537,9 @@ func (r *remoteReporter) createSnapshot() (*Snapshot, error) {
536537
// no longer be reported, and there will be no other indicator that it
537538
// was deleted. This requires special handling when interpreting the
538539
// telemetry data later.
539-
orgs, err := r.options.Database.GetOrganizations(ctx, database.GetOrganizationsParams{})
540+
// nolint:gocritic // AsSystemRestricted is fine here because it's a read-only operation
541+
// used for telemetry reporting.
542+
orgs, err := r.options.Database.GetOrganizations(dbauthz.AsSystemRestricted(r.ctx), database.GetOrganizationsParams{})
540543
if err != nil {
541544
return xerrors.Errorf("get organizations: %w", err)
542545
}

0 commit comments

Comments
 (0)