Skip to content

Conversation

@bra-i-am
Copy link
Contributor

@bra-i-am bra-i-am commented Oct 7, 2025

Warning

This PR depends on #6 because it manages the users' roles view
TODO: Add a toast to inform that the current user has already assigned a role

This pull request adds a button and a modal to assign new roles to the users from the users' roles view

Evidence

Screencast.from.15-10-25.17.11.31.webm

Testing instructions

  1. Create and set up a local environment (Tutor recommended)
  2. Run LMS and CMS, then clone the repo in the current branch and run the dev server npm run dev
  3. Add the URL to the CORS_WHITELIST in both LMS/CMS settings.py
# admin console MFE
CORS_ORIGIN_WHITELIST.append("http://apps.local.openedx.io:2025")
LOGIN_REDIRECT_WHITELIST.append("apps.local.openedx.io:2025")
CSRF_TRUSTED_ORIGINS.append("http://apps.local.openedx.io:2025")
  1. Go to the Studio and create a library
  2. Navigate to http://apps.local.openedx.io:2025/admin-console/authz/libraries/< your_library_id >
  3. Install the plugin https://github.com/openedx/openedx-authz by running tutor dev exec lms pip install git+https://github.com/openedx/openedx-authz
  4. Run the migrations tutor dev exec lms python manage.py lms migrate openedx_authz
  5. Load the default policies by running tutor dev exec lms python manage.py lms load_policies
  6. Go to http://local.openedx.io:8000/api-docs/#/authz/authz_v1_roles_users_update and add a role to any user different to the logged-in one, following the structure
{
  "role": "library_author", // Create another with "library_admin" to be able to filter
  "scope": "lib:OpenedX:testlib", // Id of the previously created library
  "users": [
    "admin"
    // more usernames or emails if wanted
  ]
}
  1. Navigate to http://apps.local.openedx.io:2025/admin-console/authz/libraries/< your_library_id >
  2. Click the Edit button at the end of the user row
  3. Click the button Add New Role, fill the form, and click save

Additional Information

openedx/openedx-authz#45

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Oct 7, 2025
@openedx-webhooks
Copy link

openedx-webhooks commented Oct 7, 2025

Thanks for the pull request, @bra-i-am!

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

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.


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 7, 2025
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Oct 8, 2025

const { mutate: assignTeamMembersRole, isPending: isAssignTeamMembersRolePending } = useAssignTeamMembersRole();

const handleAddTeamMember = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const handleAddTeamMember = () => {
const handleAddNewRole = () => {

@dcoa dcoa force-pushed the bc/add-assign-role-modal branch 2 times, most recently from 5f70bfb to b9074b0 Compare October 13, 2025 22:36
@codecov
Copy link

codecov bot commented Oct 13, 2025

Codecov Report

❌ Patch coverage is 94.82759% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.27%. Comparing base (52fbb7e) to head (b828791).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...-module/libraries-manager/LibrariesUserManager.tsx 60.00% 2 Missing ⚠️
...onents/AssignNewRoleModal/AssignNewRoleTrigger.tsx 97.14% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master       #9      +/-   ##
==========================================
+ Coverage   91.89%   92.27%   +0.37%     
==========================================
  Files          28       31       +3     
  Lines         395      453      +58     
  Branches       54       66      +12     
==========================================
+ Hits          363      418      +55     
- Misses         31       34       +3     
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bra-i-am bra-i-am changed the title feat: Add a new role to a library member feat: [FC-0099] Add a new role to a library member Oct 20, 2025
@bra-i-am bra-i-am marked this pull request as ready for review October 21, 2025 21:52
@brian-smith-tcril brian-smith-tcril self-requested a review October 21, 2025 22:15
@dcoa dcoa force-pushed the bc/add-assign-role-modal branch from a9fe6b5 to dc9e486 Compare October 21, 2025 22:34
@brian-smith-tcril
Copy link

In my testing this is working really well overall!

I did notice the lack of feedback when trying to add a role that a user already has. I see that is mentioned in the PR description as

TODO: Add a toast to inform that the current user has already assigned a role

I'm perfectly fine with it being a follow up issue if it's created on the repo so the TODO doesn't get lost in this PR.

Copy link

@brian-smith-tcril brian-smith-tcril left a comment

Choose a reason for hiding this comment

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

LGTM!

Non-blocking things to address as follow up:

  • Some tests using test id (will be addressed as part of #17)
  • No feedback when trying to add role a user already has (#21)

@brian-smith-tcril brian-smith-tcril merged commit 2259a45 into openedx:master Oct 22, 2025
6 checks passed
@github-project-automation github-project-automation bot moved this from Waiting on Author to Done in Contributions Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants