yetitwo
08/14/2024, 1:39 PMFelix Medina
08/14/2024, 2:54 PMyetitwo
08/14/2024, 2:55 PMyetitwo
08/14/2024, 2:55 PMyetitwo
08/14/2024, 2:55 PMyetitwo
08/14/2024, 2:56 PMFelix Medina
08/14/2024, 2:57 PMFelix Medina
08/14/2024, 2:58 PMyetitwo
08/14/2024, 2:58 PMyetitwo
08/14/2024, 2:58 PM/manage/accounts/1234 and then the UI is saying "this is the stuff that a user can do on account 1234?"Felix Medina
08/14/2024, 2:58 PMFelix Medina
08/14/2024, 2:59 PMFelix Medina
08/14/2024, 3:00 PMyetitwo
08/14/2024, 3:01 PMtheconductor
08/14/2024, 3:02 PMnull
Brand ->Account 1: manage_steering
Brand->Account 2: manage_applet
You want to return [manage_steering, manage_applet]?theconductor
08/14/2024, 3:03 PMFelix Medina
08/14/2024, 3:07 PMBrand ->Account 1: manage_steering I will not add that permission again but another oneyetitwo
08/14/2024, 3:12 PMyetitwo
08/14/2024, 3:12 PMyetitwo
08/14/2024, 3:13 PMany_manage_* permissions on the brand, which walk to the associated permission on an accountyetitwo
08/14/2024, 3:14 PMany_manage_* permission on the brand, which is a smaller set and can take advantage of SpiceDB being able to return early when it finds a positive resultyetitwo
08/14/2024, 3:14 PMyetitwo
08/14/2024, 3:14 PMyetitwo
08/14/2024, 3:17 PMFelix Medina
08/14/2024, 3:17 PMyetitwo
08/14/2024, 3:25 PMdefinition user {}
definition brand {
relation owner: user
relation user: user
relation account: account
permission any_view_usage = account->view_usage
permission any_manage_steering = account->manage_steering
}
definition account {
relation brand: brand
permission view_usage = brand->user
permission manage_steering = brand->owner
}
this is a simpler schema than the one you provided but it should still capture the same structure.
you'd ask account:someAccount#view_usage@user:someUser to see whether a user can view usage on an account.
you'd ask brand:someBrand#any_view_usage@user:someUser to see whether a user has view_usage on any account associated with the brand.
you'd use BulkCheckPermission to ask the above for all any_* permissions on the brand.yetitwo
08/14/2024, 3:26 PMFelix Medina
08/14/2024, 3:32 PM