Skip to content

docs: define the static authorization schema - #421

Open
mariajgrimaldi wants to merge 5 commits into
MJG/authz-schema/static-dynamic-rolesfrom
MJG/authz-schema/configuration
Open

docs: define the static authorization schema#421
mariajgrimaldi wants to merge 5 commits into
MJG/authz-schema/static-dynamic-rolesfrom
MJG/authz-schema/configuration

Conversation

@mariajgrimaldi

@mariajgrimaldi mariajgrimaldi commented Aug 27, 2026

Copy link
Copy Markdown
Member

Description

Static roles, permissions, and their display information are currently spread across Python, Casbin policy files, and frontend code. As a result, an application that adds a role or permission must update several representations and may also need changes in openedx-authz and the frontend.

This ADR defines one versioned YAML schema for static authorization definitions. Applications can declare permissions, categories, roles, role extensions, scopes, and UI metadata with stable identifiers, while deployment compiles those definitions into the rows Casbin needs.

Merge checklist:
Check off if complete or not applicable:

  • Version bumped
  • Changelog record added
  • Documentation updated (not only docstrings)
  • Fixup commits are squashed away
  • Unit tests added/updated
  • Manual testing instructions provided
  • Noted any: Concerns, dependencies, migration issues, deadlines, tickets

@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 Aug 27, 2026
@openedx-webhooks

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 Aug 27, 2026
@mariajgrimaldi mariajgrimaldi linked an issue Aug 27, 2026 that may be closed by this pull request
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Aug 27, 2026

@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.

Looking good, just added a couple of points for discussion. Thanks!


permissions:
- namespace: courses
name: view_course

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.

Should we specify a naming convention for namespaces, names and permission_categories id? Like ascii lower snake case only?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

YES!

I'm working on a reference file

@mariajgrimaldi mariajgrimaldi Sep 1, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Here it is, I think we could handle the details there once we settle on this ADR: #431

permissions:
- courses.view_course

role_extensions:

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.

Good idea, I like it.

* invalid YAML, unknown fields, missing required fields, and values with the wrong type;
* unsupported schema versions;
* IDs that contain uppercase letters or unsupported punctuation;
* icon names that are unavailable from ``@openedx/paragon/icons``; and

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.

How would we handle possible future changes to the paragon icons? Like naming changes or icon removals?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think it'd be the same as any consumer of paragon icons (MFEs, extensions and so on) they should follow a deprecation process we'd have to be attentive of


* invalid YAML, unknown fields, missing required fields, and values with the wrong type;
* unsupported schema versions;
* IDs that contain uppercase letters or unsupported punctuation;

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.

Should we enforce also snake case naming convention?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes!

@BryanttV BryanttV 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 @mariajgrimaldi!

Decision
********

#. Schema format and boundary

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.

The automatic numbering isn't working, I'm not sure why.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Mmm others ADRs might being affected by this, I'll look into it later

=============================

A permission contains:

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.

Should the permissions schema also have a version and priority?

@mariajgrimaldi mariajgrimaldi Sep 1, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'd have to look into this in more detail to weigh between the two options. Here's a brain dump:

  1. Versioning I think should be the entire file, I don't think we should individually version each permission since I don't think they would change much. Also the configuration marks the current status of the authorization system, so I think they belong to the file itself
  2. Priority would be mainly for extension patches so we know how to resolve between them. For example, if two extension patches modify the same role and one adds a permission while another removes it, priority would determine which change takes effect.

What kind of use cases can we solve by adding priority to permissions themselves?

* ``namespace`` and ``name``, which form the stable identifier used by application checks, such as ``courses.view_course``;
* the scope namespaces where it can apply;
* a normalized permission category; and
* ``display_name``, ``description``, and an optional Paragon icon name.

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.

If the Paragon icon is optional, what would be shown by default? Is there currently an easy way to validate if a Paragon icon exists? Since it is mentioned as part of the initial validation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think we can make some kind of request to render it (not sure how easy or out-of-the-box). I was thinking we could do a simple check for the name following paragon conventions. What do you think?

#. Roles and role extensions
============================

A role contains a stable identifier, display name, description, supported scope namespaces, and a list of complete permission identifiers. When an application needs to change an existing role, it uses ``role_extensions``. An extension may add or remove permissions and may replace the role's display name or description.

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.

Can we clearly define the properties that role_extensions accepts?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I opened a different ADR for this: #430

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.

Excellent! Could we include a reference to that ADR here?


schema_version: "1.0"
priority: 100

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.

Is it possible to explain a bit about how priority would work? Would there be a convention or something similar? What should happen if two plugins define the same priority?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think I do it in the validation and conflicts section, let me know if it's not clear enough: https://github.com/openedx/openedx-authz/pull/421/changes#diff-323a833929851b16109620a7eee56dfe642c78e8c26d00a06cc6c08f321182ceR115

- courses.view_course

role_extensions:
- role: course_admin

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.

Can an extension be added to a role that doesn't exist? Or is this included in the initial validation?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should be included in the validation

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Python constants and role mappings
==================================

Definitions would remain split across backend and frontend code. Applications would also need to change ``openedx-authz`` to add definitions they own.

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.

What happens to the current role and permission definitions in the Python modules? Will we keep using them? If I want to create a new permission, do I have to add it to the YAML and the Python constants file? Or will we do something different?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We'd need to entirely migrate to a configuration file to avoid having definitions scattered across multiple places

@mariajgrimaldi mariajgrimaldi Sep 1, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I made some changes: 917b782

@mariajgrimaldi
mariajgrimaldi force-pushed the MJG/authz-schema/configuration branch from be47fea to ff64cae Compare September 1, 2026 16:03
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: Waiting on Author

Development

Successfully merging this pull request may close these issues.

1. Role and permission definition ADR

5 participants