Skip to content

fix: remove legacy authz policy and action grouping - #538

Open
mariajgrimaldi wants to merge 1 commit into
mainfrom
MJG/clean-authz-policy
Open

mariajgrimaldi wants to merge 1 commit into
mainfrom
MJG/clean-authz-policy

Conversation

@mariajgrimaldi

@mariajgrimaldi mariajgrimaldi commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Description

Static role-permission policies now come from the authorization schema, so this removes authz.policy along with g2 action grouping from the Casbin model and deletes the existing g2 rows through a data migration. The 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_policies remains 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 adds load_authz_schema, so it can be extended to remove the load_policies calls 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 migrate
python manage.py load_policies
python manage.py load_authz_schema --dry-run --dir openedx_authz/authz/schema
python manage.py load_authz_schema --dir openedx_authz/authz/schema

These commands run as usual without loading policy rows from a file. In a clean database, load_policies exits successfully without a policy file, the schema command loads 132 p rows and no g2 rows, and a second run reports no changes.

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels Oct 16, 2026
@openedx-webhooks

openedx-webhooks commented Oct 16, 2026 •

Copy link
Copy Markdown

Thanks for the pull request, @mariajgrimaldi!

This repository is currently maintained by @openedx/committers-openedx-authz.

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 approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To 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:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where 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:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Oct 16, 2026
@mariajgrimaldi
mariajgrimaldi marked this pull request as draft October 16, 2026 10:23
@mariajgrimaldi
mariajgrimaldi force-pushed the MJG/clean-authz-policy branch 3 times, most recently from a60df55 to bb1563c Compare October 16, 2026 10:48
@mariajgrimaldi mariajgrimaldi changed the title refactor: retire legacy authz policy fix: remove legacy authz policy and action grouping Oct 16, 2026
@mariajgrimaldi
mariajgrimaldi marked this pull request as ready for review October 16, 2026 10:53
@mariajgrimaldi mariajgrimaldi linked an issue Oct 16, 2026 that may be closed by this pull request

@rodmgwgu rodmgwgu left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

Deprecate authz.policy file

3 participants