summaryrefslogtreecommitdiff
path: root/pkg/authz
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-24 08:52:13 -0600
committermo khan <mo@mokhan.ca>2025-07-24 08:52:13 -0600
commitd2ba49adfc03f7f6e30f60c8915f7409b66222c0 (patch)
treeae1af94f4dc86c01dc90a851ec994946f14cc10e /pkg/authz
parent4e83caaf7608c355970dbba4a76213db4cd55501 (diff)
refactor: move function to spice.go
Diffstat (limited to 'pkg/authz')
-rw-r--r--pkg/authz/grpc.go13
-rw-r--r--pkg/authz/spice.go11
2 files changed, 11 insertions, 13 deletions
diff --git a/pkg/authz/grpc.go b/pkg/authz/grpc.go
index ad5cc04..e05bdeb 100644
--- a/pkg/authz/grpc.go
+++ b/pkg/authz/grpc.go
@@ -4,10 +4,7 @@ import (
"context"
"crypto/x509"
"net"
- "os"
- v1 "github.com/authzed/authzed-go/proto/authzed/api/v1"
- "github.com/authzed/authzed-go/v1"
"gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/pls"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
@@ -48,13 +45,3 @@ func credentialsFor(ctx context.Context, host string) credentials.TransportCrede
return credentials.NewClientTLSFromCert(pool, "")
}
-
-func LoadSpiceSchema(ctx context.Context, client *authzed.Client, path string) error {
- content, err := os.ReadFile(path)
- _, err = client.WriteSchema(ctx, &v1.WriteSchemaRequest{Schema: string(content)})
- if err != nil {
- return err
- }
-
- return nil
-}
diff --git a/pkg/authz/spice.go b/pkg/authz/spice.go
index cd534a1..97adbd4 100644
--- a/pkg/authz/spice.go
+++ b/pkg/authz/spice.go
@@ -2,6 +2,7 @@ package authz
import (
"context"
+ "os"
v1 "github.com/authzed/authzed-go/proto/authzed/api/v1"
"github.com/authzed/authzed-go/v1"
@@ -24,3 +25,13 @@ func NewSpiceDBClient(ctx context.Context, host string, presharedKey string) *au
type CheckPermissionService interface {
CheckPermission(ctx context.Context, in *v1.CheckPermissionRequest, opts ...grpc.CallOption) (*v1.CheckPermissionResponse, error)
}
+
+func LoadSpiceSchema(ctx context.Context, client *authzed.Client, path string) error {
+ content, err := os.ReadFile(path)
+ _, err = client.WriteSchema(ctx, &v1.WriteSchemaRequest{Schema: string(content)})
+ if err != nil {
+ return err
+ }
+
+ return nil
+}