Closed pulpbot closed 2 years ago
Global checks can use boolean expressions if you use condition_expression
instead of condition
. e.g.
{
"action": ["destroy"],
"principal": "authenticated",
"effect": "allow",
"condition_expression": [
"(has_repo_attr_model_or_obj_perms:container.delete_containerrepository_versions or"
" has_repo_attr_model_or_obj_perms:container.view_containerrepository)",
]
}
Ref: https://rsinger86.github.io/drf-access-policy/object_level_permissions.html
Author: @goosemania (ttereshc)
Redmine Issue: 8187, https://pulp.plan.io/issues/8187
If the condition contains a boolean expression like below, and even though
has_repo_attr_model_or_obj_perms
is defined in global checks, it fails.The workaround is to split it into 2 policy statements: