Repository navigation
refactor!: remove legacy authz policy file in favor of YAML schema - #538
Conversation
|
Thanks for the pull request, @mariajgrimaldi! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
a60df55 to
bb1563c
Compare
bb1563c to
40ad803
Compare
94bde0d to
4f87391
Compare
There was a problem hiding this comment.
Thanks for this work, I have some concerns about removing g2 support tough:
This is what I had in mind originally for this ticket: Just remove the p entries from authz.policy and keep g2 for now as this is not represented in yaml currently.
Then, on #523 I was planning on modeling the permission dependencies in the yaml schema and update the compiler so it would output g2 rows based on the yaml definition.
The idea was that we would use the information from those rows to imply dependencies to be latter shown to the end user in the UI wizard when defining custom roles, so it's clear that enabling one permission implies others (when defined).
Alternatively if we remove g2, then defining the permission dependencies in YAML wouldn't have any effect at the casbin level, but only on the UI level which would then assign each permission and its dependencies one by one to a role.
I'm not 100% sure what's the best path forward, what do you think?
|
Thanks, @mariajgrimaldi! On my end, I also think we should keep the |
3d915d3 to
55b63ba
Compare
|
@rodmgwgu: I was treating permission implication as work deferred to #91 and #523 because, as far as I remember, it was intentionally left out of the schema. I can limit this PR to removing the p entries from authz.policy and leave the g2 model, matcher, and rows in place for #523 to migrate to YAML. |
1e392f3 to
e91c1b7
Compare
Load static role-permission definitions from the authorization schema while preserving existing Casbin g2 relationships. Calls to load_policies without an explicit file now return without changing the database.
e91c1b7 to
cd4d146
Compare
rodmgwgu
left a comment
There was a problem hiding this comment.
Thanks for addressing my comments, LGTM!
|
Changing this to |
Description
Static role-permission policies now come from the authorization schema, so this removes
authz.policyalong with.g2action grouping from the Casbin model and deletes the existingg2rows through a data migrationThe built-in roles already list every permission covered by those relationships and the tests now verify those explicit assignments, which means this is not a breaking change for supported configurations.Permission grouping and role inheritance remain outside the authorization schema, with that work tracked in #91 and #523.
load_policiesremains available because Tutor still calls it during LMS and CMS initialization, although calls without a policy file now do nothing. Open PR overhangio/tutor#1496 addsload_authz_schema, so it can be extended to remove theload_policiescalls or overhangio/tutor#1509 can make that change separately. Issue #539 tracks whether the explicit custom-file workflow remains supported as is and whether the command should be removed after the Tutor change is released.Solves #462
How to Test
Run:
python manage.py migrateThese commands run as usual without loading policy rows from a file. In a clean database,
load_policiesexits successfully without a policy file, the schema command loads 132prows and nog2rows, and a second run reports no changes.