bitter-greece-62664
08/27/2025, 7:01 PMclass User implements Namespace {}
class Role implements Namespace {
related: {
members: User[]
}
}
class Asset implements Namespace {
related: {
admins: SubjectSet<Role, "members">[]
managers: SubjectSet<Role, "members">[]
readers: SubjectSet<Role, "members">[]
}
permits = {
create: (ctx: Context): boolean =>
this.related.admins.includes(ctx.subject),
read: (ctx: Context): boolean =>
this.related.readers.includes(ctx.subject) ||
this.permits.create(ctx) ||
this.permits.update(ctx) ||
this.permits.delete(ctx),
update: (ctx: Context): boolean =>
this.related.admins.includes(ctx.subject),
delete: (ctx: Context): boolean =>
this.related.admins.includes(ctx.subject),
}
}
If we perform a permission check like
GET /relation-tuples/check?namespace=Asset&object=asset_a&subject_id=User:user_a&relation=read
We get {"allowed":true}
as expected.
We now want to get the list of asset a user can read.
So we use the expand api
GET /relation-tuples/expand?namespace=Asset&object=9e4bb2e5-c9bb-4882-801d-4092cdb6b166&relation=read
And here we get no relation tuple found
But using a direct relation like
`GET /relation-tuples/expand?namespace=Asset&object=9e4bb2e5-c9bb-4882-801d-4092cdb6b166&relation=admins``
yield the tuple.
If we are not able to use the expand api to get the information, we'd need to reproduce the permits
section in our application. Which seems counterintuitive.steep-lamp-91158
bitter-greece-62664
08/28/2025, 1:08 PMpermits
when implemented, but it'd be awesome to be able to track thissteep-lamp-91158
bitter-greece-62664
08/28/2025, 4:18 PMsteep-lamp-91158