Skip to content

feat: Implement courses roles and permissions mappings#217

Open
rodmgwgu wants to merge 3 commits intoopenedx:mainfrom
WGU-Open-edX:rod/compat-layer
Open

feat: Implement courses roles and permissions mappings#217
rodmgwgu wants to merge 3 commits intoopenedx:mainfrom
WGU-Open-edX:rod/compat-layer

Conversation

@rodmgwgu
Copy link
Contributor

@rodmgwgu rodmgwgu commented Feb 16, 2026

Implemented courses roles and permissions mappings, including legacy compatible permissions and role equivalences.

Permissions implemented as specified here: https://openedx.atlassian.net/wiki/spaces/OEPM/pages/5528715266/openedx-authz+permission+list

Roles implemented as specified here: https://openedx.atlassian.net/wiki/spaces/OEPM/pages/5638619138/Authoring+Roles+and+Permissions

Equivalent legacy roles implemented as specified here: https://github.com/rodmgwgu/openedx-authz/blob/385e76d4e95381bb6533df5272ecff6593e09156/docs/decisions/0011-course-authoring-migration-process.rst

Closes: #189

Required for: openedx/openedx-platform#38013

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 Feb 16, 2026
@openedx-webhooks
Copy link

openedx-webhooks commented Feb 16, 2026

Thanks for the pull request, @rodmgwgu!

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 Feb 16, 2026
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Feb 18, 2026
@mphilbrick211 mphilbrick211 added the mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). label Feb 18, 2026
Copy link
Contributor

@wgu-taylor-payne wgu-taylor-payne left a comment

Choose a reason for hiding this comment

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

This looks good. Just one comment regarding the version number.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this would be a minor bump to 0.22.0 since it is adding functionality rather than bug fixes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks!

@rodmgwgu rodmgwgu requested a review from bmtcril February 19, 2026 15:48
Copy link
Contributor

@dwong2708 dwong2708 left a comment

Choose a reason for hiding this comment

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

LGTM, just one suggestion in the legacy roles mapping.

COURSE_BETA_TESTER = RoleData(external_key="course_beta_tester", permissions=COURSE_BETA_TESTER_PERMISSIONS)

# Map of legacy course role names to their equivalent new roles
LEGACY_COURSE_ROLE_EQUIVALENCES = {
Copy link
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 reverse the mapping order?

For example:

{
    COURSE_ADMIN.external_key: "instructor",
    ...
}

Reason: while working on the migration, during rollback (authz → legacy), I only have access to new_role.key, so I need a way to map it back to the corresponding legacy role.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is how I'm doing it in openedx-platform: https://github.com/WGU-Open-edX/openedx-platform/blob/5dc65a27a4cfc9f8045ab71fca19965f7127f488/common/djangoapps/student/roles.py#L39

I also need it both ways there, I did it that way to avoid having to maintain two maps, what do you think?

Copy link
Contributor

@dwong2708 dwong2708 Feb 19, 2026

Choose a reason for hiding this comment

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

Sounds good, just one consideration.

If we have a mapping like:

{
    "instructor": "admin",
    "staff": "admin",
}

get_legacy_role_from_authz_role would just pick the first match. Not sure if this case is expected, but maybe we should add a comment here or in the function to clarify the behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mmm where do you see that? instructor is "admin" but staff should be "staff" as documented here: https://github.com/rodmgwgu/openedx-authz/blob/385e76d4e95381bb6533df5272ecff6593e09156/docs/decisions/0011-course-authoring-migration-process.rst (Role Mapping table)

effect="allow",
)

VIEW_SCHEDULE_AND_DETAILS = PermissionData(
Copy link
Contributor

Choose a reason for hiding this comment

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

Quick question: should detail be a separate permission?

Not sure if it belongs in the same section, but the docs say view_details is used for viewing course details.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was a discussion I had with Guillermo, the Schedule and Details view is a single view, separating the permissions would require extra changes in frontend that are not really needed, so a single permission was proposed, the docs may not be updated

effect="allow",
)

EDIT_DETAILS = PermissionData(
Copy link
Contributor

Choose a reason for hiding this comment

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

Something else came to mind. I think that some of these constant names could be more descriptive. Since we have library related permissions, course permissions, and in the future other permissions in this file, it would be good to rename some of these like EDIT_DETAILS, VIEW_FILES, etc. to show somehow that they are course related. Another option would be to scope the various permission namespaces to their own modules (e.g. course_permissions.py, library_permissions.py).

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). mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). 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.

Task - RBAC AuthZ - Implement roles and permissions in openedx-authz

5 participants

Comments