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

Method CountAuditLogs

coderd/database/dbauthz/dbauthz.go:1815–1827  ·  view source on GitHub ↗
(ctx context.Context, arg database.CountAuditLogsParams)

Source from the content-addressed store, hash-verified

1813}
1814
1815func (q *querier) CountAuditLogs(ctx context.Context, arg database.CountAuditLogsParams) (int64, error) {
1816 // Shortcut if the user is an owner. The SQL filter is noticeable,
1817 // and this is an easy win for owners. Which is the common case.
1818 err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceAuditLog)
1819 if err == nil {
1820 return q.db.CountAuditLogs(ctx, arg)
1821 }
1822 prep, err := prepareSQLFilter(ctx, q.auth, policy.ActionRead, rbac.ResourceAuditLog.Type)
1823 if err != nil {
1824 return 0, xerrors.Errorf("(dev error) prepare sql filter: %w", err)
1825 }
1826 return q.db.CountAuthorizedAuditLogs(ctx, arg, prep)
1827}
1828
1829func (q *querier) CountConnectionLogs(ctx context.Context, arg database.CountConnectionLogsParams) (int64, error) {
1830 // Just like the actual query, shortcut if the user is an owner.

Callers 1

Calls 5

authorizeContextMethod · 0.95
prepareSQLFilterFunction · 0.85
CountAuditLogsMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected