Skip to content

Commit b9ccc5a

Browse files
committed
fixup
1 parent 555b045 commit b9ccc5a

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

coderd/database/dbauthz/dbauthz.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,16 +1206,13 @@ func (q *querier) GetAuditLogsOffset(ctx context.Context, arg database.GetAuditL
12061206
// Applying a SQL filter would slow down the query for no benefit on how this query is
12071207
// actually used.
12081208

1209+
object := rbac.ResourceAuditLog
12091210
if arg.OrganizationID != uuid.Nil {
1210-
// Organization scoped logs
1211-
if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceAuditLog.InOrg(arg.OrganizationID)); err != nil {
1212-
return nil, err
1213-
}
1214-
} else {
1215-
// Site wide scoped logs
1216-
if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceAuditLog); err != nil {
1217-
return nil, err
1218-
}
1211+
object = object.InOrg(arg.OrganizationID)
1212+
}
1213+
1214+
if err := q.authorizeContext(ctx, policy.ActionRead, object); err != nil {
1215+
return nil, err
12191216
}
12201217

12211218
return q.db.GetAuditLogsOffset(ctx, arg)

0 commit comments

Comments
 (0)