MCPcopy Create free account
hub / github.com/coder/coder / GetUserLatencyInsights

Method GetUserLatencyInsights

coderd/database/dbauthz/dbauthz.go:4695–4715  ·  view source on GitHub ↗
(ctx context.Context, arg database.GetUserLatencyInsightsParams)

Source from the content-addressed store, hash-verified

4693}
4694
4695func (q *querier) GetUserLatencyInsights(ctx context.Context, arg database.GetUserLatencyInsightsParams) ([]database.GetUserLatencyInsightsRow, error) {
4696 // Used by insights endpoints. Need to check both for auditors and for regular users with template acl perms.
4697 if err := q.authorizeContext(ctx, policy.ActionViewInsights, rbac.ResourceTemplate); err != nil {
4698 for _, templateID := range arg.TemplateIDs {
4699 template, err := q.db.GetTemplateByID(ctx, templateID)
4700 if err != nil {
4701 return nil, err
4702 }
4703
4704 if err := q.authorizeContext(ctx, policy.ActionViewInsights, template); err != nil {
4705 return nil, err
4706 }
4707 }
4708 if len(arg.TemplateIDs) == 0 {
4709 if err := q.authorizeContext(ctx, policy.ActionViewInsights, rbac.ResourceTemplate.All()); err != nil {
4710 return nil, err
4711 }
4712 }
4713 }
4714 return q.db.GetUserLatencyInsights(ctx, arg)
4715}
4716
4717func (q *querier) GetUserLinkByLinkedID(ctx context.Context, linkedID string) (database.UserLink, error) {
4718 if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceSystem); err != nil {

Callers

nothing calls this directly

Calls 4

authorizeContextMethod · 0.95
AllMethod · 0.80
GetTemplateByIDMethod · 0.65

Tested by

no test coverage detected