kabielake
03/26/2024, 9:08 AMdefinition subject_a {}
definition subject_b {}
definition group {
relation action_a_taker: todo
permission action_a = action_a_taker
}
definition role {
relation group: group
relation role_user: subject_a | subject_b
}
Is it possible to specify a specific object type in combination with a subject relation? Something like:
relation action_a_taker: role#role_user but only if role_user is of type subject_a
vroldanbet
03/26/2024, 10:32 AMrole#role_user
, you take any possible type of that relation. But how is that impacting your usecase?
When you do a PermissionCheck
you specify a type, so if you do check resource1 view subject_a
then subject_b
will be ignored.
So I guess I have to ask what are you trying to actually achieve?kabielake
03/26/2024, 11:25 AMblog
person
user_account
profile
And the following roles:
site_admin
use_account
edit_profile
Here are the constraints:
- the only valid role when the object is a blog is "site_admin", and the subject must be a person
- a person (the subject) may have either the "moderator" or "use_account" role to a user_account (the object), but would never have a role directly to the profile
- a user account (the subject) may only have the role "edit_profile" to a profile (the object), but would not be the subject in any other rules
So I would like to achieve something like this:
definition blog {
relation site_admin: rule#actor (but only valid if rule#actor is a person)
}
definition person {}
definition user_account {}
definition profile {
relation editor: rule#actor (but only valid when the rule#actor is a user_account)
}
definition rule {
relation parent_blog: blog
relation actor: person | user_account
}