feat: Require scopeId on domain tables to ensure user isolation (#73)

This commit is contained in:
Marcelo Mendonça Soares 2026-06-18 01:05:24 -03:00 • committed by GitHub
commit 84cfbadc45
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
40 changed files with 4258 additions and 770 deletions

View file

@ -0,0 +1,6 @@
analyzer:
errors:
camel_case_types: ignore
formatter:
trailing_commas: preserve

View file

@ -8,7 +8,7 @@ environment:
resolution: workspace
dependencies:
serverpod_client: 3.5.0-beta.9
serverpod_database: 3.5.0-beta.9
serverpod_client: 3.5.0-beta.10
serverpod_database: 3.5.0-beta.10
serverpod_offline_sync_client:
path: ../../packages/serverpod_offline_sync_client

View file

@ -3,6 +3,8 @@ table: address
database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
street: String
inhabitantId: UuidValue?, unique
inhabitant: Person?, relation(name=person_address, field=inhabitantId, onDelete=Restrict)

View file

@ -3,6 +3,8 @@ table: city
database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
name: String
citizens: List<Person>?, relation
organizations: List<Organization>?, relation(name=city_org)

View file

@ -3,6 +3,8 @@ table: company
database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
name: String
town: Town?, relation(field=townId, onDelete=SetDefault)
townId: UuidValue, default='550e8400-e29b-41d4-a716-446655440000'

View file

@ -3,6 +3,8 @@ table: fk_chain_cascade_middle
database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
name: String
root: FkChainRoot?, relation(field=rootId, onDelete=Cascade)
rootId: UuidValue?

View file

@ -3,6 +3,8 @@ table: fk_chain_middle_cascade_child
database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
name: String
restrictBlocker: FkChainRestrictBlocker?, relation(field=restrictBlockerId, onDelete=Cascade)
restrictBlockerId: UuidValue?

View file

@ -3,6 +3,8 @@ table: fk_chain_middle_set_null_child
database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
name: String
restrictBlocker: FkChainRestrictBlocker?, relation(field=restrictBlockerId, onDelete=SetNull)
restrictBlockerId: UuidValue?

View file

@ -3,6 +3,8 @@ table: fk_chain_restrict_blocker
database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
name: String
cascadeMiddle: FkChainCascadeMiddle?, relation(field=cascadeMiddleId, onDelete=Restrict)
cascadeMiddleId: UuidValue?

View file

@ -3,4 +3,6 @@ table: fk_chain_root
database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
name: String

View file

@ -3,6 +3,8 @@ table: fk_chain_set_null_cascade_child
database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
name: String
setNullMiddle: FkChainSetNullMiddle?, relation(field=setNullMiddleId, onDelete=Cascade)
setNullMiddleId: UuidValue?

View file

@ -3,6 +3,8 @@ table: fk_chain_set_null_middle
database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
name: String
cascadeMiddle: FkChainCascadeMiddle?, relation(field=cascadeMiddleId, onDelete=SetNull)
cascadeMiddleId: UuidValue?

View file

@ -3,6 +3,8 @@ table: fk_chain_set_null_restrict_child
database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
name: String
setNullMiddle: FkChainSetNullMiddle?, relation(field=setNullMiddleId, onDelete=Restrict)
setNullMiddleId: UuidValue?

View file

@ -3,6 +3,8 @@ table: fk_chain_set_null_set_null_child
database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
name: String
setNullMiddle: FkChainSetNullMiddle?, relation(field=setNullMiddleId, onDelete=SetNull)
setNullMiddleId: UuidValue?

View file

@ -3,6 +3,8 @@ table: organization
database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
name: String
people: List<Person>?, relation(name=org_person)
city: City?, relation(name=city_org, optional, onDelete=Cascade)

View file

@ -3,6 +3,8 @@ table: person
database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
name: String
surname: String?
address: Address?, relation(name=person_address)

View file

@ -3,6 +3,8 @@ table: required_set_null_child
database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
name: String
parent: Person?, relation(field=parentId, onDelete=SetNull)
parentId: UuidValue

View file

@ -3,6 +3,8 @@ table: restrict_child
database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
name: String
parent: Person?, relation(field=parentId, onDelete=Restrict)
parentId: UuidValue?

View file

@ -3,6 +3,8 @@ table: town
database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
name: String
city: City?, relation(optional, onDelete=Cascade)
mayor: Person?, relation(optional, onDelete=SetNull)

View file

@ -4,6 +4,8 @@ table: types
database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
aBool: bool
aDateTime: DateTime
aText: String

Some files were not shown because too many files have changed in this diff Show more