Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify schema to only be subjects, roles and tenants #50

Merged
merged 1 commit into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions internal/query/tenants.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,20 +205,6 @@ func GetResourceTypes() []*ResourceType {
DBType: "subject",
URNPrefix: "urn:infratographer:subject",
},
{
Name: "Load balancer",
DBType: "loadbalancer",
URNPrefix: "urn:infratographer:loadbalancer",
Relationships: []*ResourceRelationship{
{
Name: "Tenant",
Field: "tenant_id",
DBTypes: "tenant",
DBRelation: "tenant",
Optional: false,
},
},
},
}
}

Expand Down
2 changes: 1 addition & 1 deletion internal/query/tenants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func dbTest(ctx context.Context, t *testing.T) *query.Stores {
}

func cleanDB(ctx context.Context, t *testing.T, client *authzed.Client) {
for _, dbType := range []string{"subject", "role", "tenant", "loadbalancer"} {
for _, dbType := range []string{"subject", "role", "tenant"} {
delRequest := &pb.DeleteRelationshipsRequest{RelationshipFilter: &pb.RelationshipFilter{ResourceType: dbType}}
_, err := client.DeleteRelationships(ctx, delRequest)
require.NoError(t, err, "failure deleting relationships")
Expand Down
12 changes: 0 additions & 12 deletions internal/spicedbx/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@ definition PREFIX/tenant {
permission loadbalancer_update = loadbalancer_update_rel + parent->loadbalancer_update
permission loadbalancer_delete = loadbalancer_delete_rel + parent->loadbalancer_delete
}

definition PREFIX/loadbalancer {
relation tenant: PREFIX/tenant

relation loadbalancer_get_rel: PREFIX/role#subject
relation loadbalancer_update_rel: PREFIX/role#subject
relation loadbalancer_delete_rel: PREFIX/role#subject

permission loadbalancer_get = loadbalancer_get_rel + tenant->loadbalancer_get
permission loadbalancer_update = loadbalancer_update_rel + tenant->loadbalancer_update
permission loadbalancer_delete = loadbalancer_delete_rel + tenant->loadbalancer_delete
}
`

if prefix != "" && !strings.HasSuffix(prefix, "/") {
Expand Down