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

Method GetUserActivityInsights

coderd/database/dbauthz/dbauthz.go:4567–4587  ·  view source on GitHub ↗
(ctx context.Context, arg database.GetUserActivityInsightsParams)

Source from the content-addressed store, hash-verified

4565}
4566
4567func (q *querier) GetUserActivityInsights(ctx context.Context, arg database.GetUserActivityInsightsParams) ([]database.GetUserActivityInsightsRow, error) {
4568 // Used by insights endpoints. Need to check both for auditors and for regular users with template acl perms.
4569 if err := q.authorizeContext(ctx, policy.ActionViewInsights, rbac.ResourceTemplate); err != nil {
4570 for _, templateID := range arg.TemplateIDs {
4571 template, err := q.db.GetTemplateByID(ctx, templateID)
4572 if err != nil {
4573 return nil, err
4574 }
4575
4576 if err := q.authorizeContext(ctx, policy.ActionViewInsights, template); err != nil {
4577 return nil, err
4578 }
4579 }
4580 if len(arg.TemplateIDs) == 0 {
4581 if err := q.authorizeContext(ctx, policy.ActionViewInsights, rbac.ResourceTemplate.All()); err != nil {
4582 return nil, err
4583 }
4584 }
4585 }
4586 return q.db.GetUserActivityInsights(ctx, arg)
4587}
4588
4589func (q *querier) GetUserAgentChatSendShortcut(ctx context.Context, userID uuid.UUID) (string, error) {
4590 user, err := q.db.GetUserByID(ctx, userID)

Callers

nothing calls this directly

Calls 4

authorizeContextMethod · 0.95
AllMethod · 0.80
GetTemplateByIDMethod · 0.65

Tested by

no test coverage detected