Skip to content

Commit 4b2e99f

Browse files
committed
Begin removing all old code
1 parent d8fce5e commit 4b2e99f

File tree

14 files changed

+121
-854
lines changed

14 files changed

+121
-854
lines changed

coderd/rbac/authz.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package rbac
33
import (
44
"context"
55
_ "embed"
6+
"github.com/coder/coder/coderd/rbac/regosql"
67
"sync"
78

89
"github.com/open-policy-agent/opa/rego"
@@ -20,7 +21,7 @@ type Authorizer interface {
2021

2122
type PreparedAuthorized interface {
2223
Authorize(ctx context.Context, object Object) error
23-
Compile() (AuthorizeFilter, error)
24+
Compile(cfg regosql.ConvertConfig) (AuthorizeFilter, error)
2425
}
2526

2627
// Filter takes in a list of objects, and will filter the list removing all

coderd/rbac/authz_internal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ func testAuthorize(t *testing.T, name string, subject subject, sets ...[]authTes
847847

848848
// Ensure the partial can compile to a SQL clause.
849849
// This does not guarantee that the clause is valid SQL.
850-
_, err = Compile(partialAuthz)
850+
_, err = Compile(ConfigWithACL(), partialAuthz)
851851
require.NoError(t, err, "compile prepared authorizer")
852852

853853
// Also check the rego policy can form a valid partial query result.

coderd/rbac/partial.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package rbac
33
import (
44
"context"
55

6+
"github.com/coder/coder/coderd/rbac/regosql"
67
"golang.org/x/xerrors"
78

89
"github.com/open-policy-agent/opa/ast"
@@ -28,8 +29,8 @@ type PartialAuthorizer struct {
2829

2930
var _ PreparedAuthorized = (*PartialAuthorizer)(nil)
3031

31-
func (pa *PartialAuthorizer) Compile() (AuthorizeFilter, error) {
32-
filter, err := Compile(pa)
32+
func (pa *PartialAuthorizer) Compile(cfg regosql.ConvertConfig) (AuthorizeFilter, error) {
33+
filter, err := Compile(cfg, pa)
3334
if err != nil {
3435
return nil, xerrors.Errorf("compile: %w", err)
3536
}

0 commit comments

Comments
 (0)