Skip to content

Commit 8cb2f65

Browse files
committed
[spicedb] Small schema adjustments
1 parent 04ef745 commit 8cb2f65

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

components/server/src/authorization/definitions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ export type Permission = UserPermission | InstallationPermission | OrganizationP
1313

1414
export type UserResourceType = "user";
1515

16-
export type UserRelation = "self" | "container";
16+
export type UserRelation = "self" | "organization" | "installation";
1717

18-
export type UserPermission = "read_info" | "write_info" | "suspend";
18+
export type UserPermission = "read_info" | "write_info";
1919

2020
export type InstallationResourceType = "installation";
2121

components/spicedb/schema/schema.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
schema: |-
66
definition user {
77
relation self: user
8-
relation container: organization | installation
8+
9+
// Only ONE of the following relations is ever present for a given user (XOR)
10+
relation organization: organization
11+
relation installation: installation
912
1013
// permissions
11-
permission read_info = self + container->member + container->owner + container->admin
12-
permission write_info = self + container->owner + container->admin
13-
permission suspend = self + container->owner + container->admin
14+
permission read_info = self + organization->member + organization->owner + installation->admin
15+
permission write_info = self
1416
}
1517
1618
// There's only one global installation
@@ -80,7 +82,7 @@ schema: |-
8082
relationships: |-
8183
// we have one installation
8284
installation:installation_0#member@user:user_0
83-
user:user_0#container@installation:installation_0
85+
user:user_0#installation@installation:installation_0
8486
8587
installation:installation_0#admin@user:user_admin
8688

0 commit comments

Comments
 (0)