Dev Devon
04/02/2025, 3:39 AMyaml
definition user {
relation team: user_team
relation profile: profile_binding
// You can access a user's page if you are the admin of all users, or this user is in your team
permission access_management_page = profile->admin_all_users + (profile->admin_team_users & team->same_team)
}
definition user_team {
relation member: user
permission same_team = member
}
definition profile {
// Possible permissions each profile could have enabled
// user:* => “any user who holds this profile will have this permission”
relation admin_all_users: user:*
relation admin_team_users: user:*
permission admin_all_users_enabled = admin_all_users
permission admin_team_users_enabled = admin_team_users
}
// This is acting as a synthetic relation (not needed once nested -> is a thing)
definition profile_binding {
relation bound_user: user
relation bound_profile: profile
// Check that user has the profile AND the profile has the permission
permission admin_all_users = bound_user & bound_profile->admin_all_users_enabled
permission admin_team_users = bound_user & bound_profile->admin_team_users_enabled
}
It works... BUT the issue I have is when I setup the relationships - now every user needs to know about every profile binding...Dev Devon
04/02/2025, 3:40 AMuser:admin_laurence#profile@profile_binding:laurence_is_profile_admin_all_users
user:basic_ben#profile@profile_binding:laurence_is_profile_admin_all_users
user:admin_jaram#profile@profile_binding:laurence_is_profile_admin_all_users
user:admin_laurence#profile@profile_binding:jaram_is_profile_admin_only_team
user:basic_ben#profile@profile_binding:jaram_is_profile_admin_only_team
user:admin_jaram#profile@profile_binding:jaram_is_profile_admin_only_team
Dev Devon
04/02/2025, 3:40 AMDev Devon
04/02/2025, 3:50 AMyetitwo
04/02/2025, 5:09 PMyetitwo
04/02/2025, 5:09 PMyetitwo
04/02/2025, 5:09 PMplatform
objectyetitwo
04/02/2025, 5:10 PMyetitwo
04/02/2025, 5:10 PMDev Devon
04/02/2025, 9:19 PMprofile->admin_all_users
Dev Devon
04/02/2025, 9:24 PMyetitwo
04/02/2025, 9:34 PMyetitwo
04/02/2025, 9:35 PMyetitwo
04/02/2025, 9:36 PMyetitwo
04/02/2025, 9:36 PMDev Devon
04/02/2025, 9:36 PMyetitwo
04/02/2025, 9:36 PMDev Devon
04/02/2025, 9:36 PMyetitwo
04/02/2025, 9:36 PMyetitwo
04/02/2025, 9:39 PMyetitwo
04/02/2025, 9:40 PMplatform
object rather than the user
objectyetitwo
04/02/2025, 9:40 PMyetitwo
04/02/2025, 9:41 PMDev Devon
04/02/2025, 9:52 PMaccess_management_page
permission enabled OR allow access to access_management_page
of only users in your team. I have attempted to follow your approach here - using organisation as our singleton - https://play.authzed.com/s/xS8FUsgtpmeX/schemaeDev Devon
04/02/2025, 9:56 PMyetitwo
04/03/2025, 2:17 PM