(ctx context.Context, arg database.GetUserLatencyInsightsParams)
| 4693 | } |
| 4694 | |
| 4695 | func (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 | |
| 4717 | func (q *querier) GetUserLinkByLinkedID(ctx context.Context, linkedID string) (database.UserLink, error) { |
| 4718 | if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceSystem); err != nil { |
nothing calls this directly
no test coverage detected