MCPcopy Index your code
hub / github.com/coder/coder / asOwner

Function asOwner

coderd/x/chatd/chattool/listtemplates.go:150–156  ·  view source on GitHub ↗

asOwner sets up a dbauthz context for the given owner so that subsequent database calls are scoped to what that user can access.

(ctx context.Context, db database.Store, ownerID uuid.UUID)

Source from the content-addressed store, hash-verified

148// asOwner sets up a dbauthz context for the given owner so that
149// subsequent database calls are scoped to what that user can access.
150func asOwner(ctx context.Context, db database.Store, ownerID uuid.UUID) (context.Context, error) {
151 actor, _, err := httpmw.UserRBACSubject(ctx, db, ownerID, rbac.ScopeAll)
152 if err != nil {
153 return ctx, xerrors.Errorf("load user authorization: %w", err)
154 }
155 return dbauthz.As(ctx, actor), nil
156}

Callers 6

workspaceQuotaDetailsFunction · 0.85
CreateWorkspaceFunction · 0.85
StartWorkspaceFunction · 0.85
ReadTemplateFunction · 0.85
ListTemplatesFunction · 0.85
StopWorkspaceFunction · 0.85

Calls 3

UserRBACSubjectFunction · 0.92
AsFunction · 0.92
ErrorfMethod · 0.45

Tested by

no test coverage detected