Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PBAC Update user roles and permissions #567

Open
wants to merge 109 commits into
base: 3.2.0
Choose a base branch
from

Conversation

Alejandro-Vega
Copy link
Collaborator

@Alejandro-Vega Alejandro-Vega commented Dec 17, 2024

Overview

A base to support the transition from RBAC to PBAC as well as the User role updates. By making these updates, it caused errors across the entire project. This PR introduces a way to check if a user has permission to do certain actions, as well as resolving all of the errors caused by these changes.

Warning

This will likely break a lot of existing logic and the BE doesn't even currently support this. Although, in order to work on tickets related to PBAC properly and without errors, this transition is necessary. Therefore, this should probably not be merged until it is stabilized.

Warning

This is not a complete solution. Only the errors were fixed, other changes should be mostly described in Tasks/User Stories and should be updated accordingly.

Change Details (Specifics)

  • Created a configuration to centralize the management of PBAC as well as a simple way of checking if a User has permissions to perform certain actions or access certain resources
  • The AuthPermissions config supports dynamic checking, given certain data. For example, you can pass in a data submission as additional param, and in the config you can use that param to determine whether or not a permission should be enabled.
  • User roles were condensed to just 5
    • "User"
    • "Submitter"
    • "Federal Lead"
    • "Admin"
    • "Data Commons Personnel"
  • The following roles were removed/combined with other roles
    • "Organization Owner" => "Submitter"
    • "Federal Monitor" => "Federal Lead"
    • "Data Curator" => "Data Commons Personnel"
    • "Data Commons POC" => "Data Commons Personnel"
  • Any and all errors relating to the removal of these roles were resolved and replaced with a new way of checking if a user has permission.
  • Verified Request Access button is displayed based on permission instead of role

Related Ticket(s)

N/A

@Alejandro-Vega Alejandro-Vega added the 🚧 Do Not Merge This PR is not ready for merging label Dec 17, 2024
@Alejandro-Vega Alejandro-Vega added this to the 3.2.0 (PMVP-M3) milestone Dec 17, 2024
@coveralls
Copy link
Collaborator

coveralls commented Dec 17, 2024

Pull Request Test Coverage Report for Build 12603126762

Details

  • 249 of 330 (75.45%) changed or added relevant lines in 30 files are covered.
  • 7 unchanged lines in 6 files lost coverage.
  • Overall coverage increased (+1.1%) to 57.655%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/hooks/useFormMode.ts 2 3 66.67%
src/utils/formModeUtils.ts 10 11 90.91%
src/components/DataSubmissions/ValidationControls.tsx 13 15 86.67%
src/content/questionnaire/FormView.tsx 0 2 0.0%
src/content/OperationDashboard/DashboardView.tsx 5 10 50.0%
src/components/Header/components/HeaderTabletAndMobile.tsx 3 9 33.33%
src/content/dataSubmissions/DataSubmission.tsx 0 7 0.0%
src/content/users/Controller.tsx 0 7 0.0%
src/content/organizations/Controller.tsx 0 8 0.0%
src/content/dataSubmissions/DataSubmissionActions.tsx 0 9 0.0%
Files with Coverage Reduction New Missed Lines %
src/content/users/ProfileView.tsx 1 0.0%
src/content/questionnaire/FormView.tsx 1 0.0%
src/content/dataSubmissions/DataSubmissionActions.tsx 1 0.0%
src/content/OperationDashboard/DashboardView.tsx 1 55.74%
src/content/dataSubmissions/DataSubmission.tsx 1 0.0%
src/components/Header/components/NavbarDesktop.tsx 2 52.63%
Totals Coverage Status
Change from base Build 12601504354: 1.1%
Covered Lines: 3958
Relevant Lines: 6442

💛 - Coveralls

Alejandro-Vega and others added 26 commits December 30, 2024 18:20
CRDCDH-2118 Operation Dashboard – Studies filter utilizes "All" studies selected
CRDCDH-2105 PBAC – Individual Permissions Control of User Accounts
CRDCDH-2098 PBAC - Data Submission Button Visibility
CRDCDH-2102 PBAC – Navigation Bar and Management Tools
CRDCDH-2102 fix: The `useProfileFields` hook should utilize PBAC
@amattu2 amattu2 temporarily deployed to dev2 January 2, 2025 19:03 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚧 Do Not Merge This PR is not ready for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants