-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
COST-4764 Set lower level rbac roles when only top level are set for OpenShift cluster/node/project #5020
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #5020 +/- ##
=======================================
- Coverage 94.1% 94.1% -0.0%
=======================================
Files 377 377
Lines 31230 31237 +7
Branches 3709 3713 +4
=======================================
+ Hits 29390 29393 +3
- Misses 1171 1174 +3
- Partials 669 670 +1 |
What is being fixed? Should we be allowing partial matching when filtering? I don't think we should because this was explicitly disallowed with this issue: |
cf26bfd
to
27ae496
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
Jira Ticket
COST-4764
Description
This change will fix partial matching for things like project/node filtering with a higher level rbac roles such as cluster by explicitly implying the correct lower level role accordingly.
Example:
If you restrict to a single cluster this change will set node and project role to * (Access all items beneath that cluster)
Testing
python koku/manage.py shell
from koku.rbac import _apply_access
_apply_access({'openshift.cluster': [{'operation': 'read', 'resources': ['test_cluster']}]})
*
for node/projectAdditional testing:
Try various access settings such as node and project levels:
_apply_access({'openshift.cluster': [{'operation': 'read', 'resources': ['test_cluster']}], 'openshift.node': [{'operation': 'read', 'resources': ['test_node']}]})
_apply_access({'openshift.cluster': [{'operation': 'read', 'resources': ['test_cluster']}], 'openshift.node': [{'operation': 'read', 'resources': ['test_node']}], 'openshift.project': [{'operation': 'read', 'resources': ['test_project']}]})
really adventurous you can try these too
'openshift.node': [{'operation': 'read', 'resources': ['test_node']}]
result:
'openshift.cluster': {'read': []},
'openshift.node': {'read': ['test_node]},
'openshift.project': {'read': ['*']},
'openshift.project': [{'operation': 'read', 'resources': ['test_project']}]
result:
'openshift.cluster': {'read': []},
'openshift.node': {'read': []},
'openshift.project': {'read': ['test_project']},
Release Notes