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

Role assignment UI #2739

Merged
merged 95 commits into from
Mar 15, 2023
Merged

Conversation

allisonking
Copy link
Contributor

@allisonking allisonking commented Mar 2, 2023

Closes https://github.com/ethyca/fidesplus/issues/641

This branches off of multiple branches, so the diff will be unseemly until those branches are merged

Branches are merged, though commit history has many of the commits from #2682 because of the squashed merge + I'm not good enough at rebasing 🙃

Code Changes

  • See the ticket

Steps to Confirm

  • list any manual steps for reviewers to confirm the changes

Pre-Merge Checklist

Description Of Changes

Write some things here about the changes and any potential caveats

pattisdr and others added 30 commits February 27, 2023 13:02
- Add system id list to client
- Add methods to add and remove users as system managers.
- When creating tokens, persist a list of system ids to the token.
…points that have limited system manager permissions.

- Multiple variations required depending on whether it is the fides key or a request body as dependencies.
- Separate out "system update" and "system delete" from the crud routes to give an additional system manager oauth check.
-  Update these endpoints to have new "system update" and "system delete" scopes.
- Bump downrev of migration.
- Rename _has_correct_scopes to has_scope_subset since I will share this method between files
- Move some common logic in verify_oauth_util into a new method: extract_token_and_load_client that can be shared with multiple authentication methods.
- Update client on login with scopes/roles/systems if client already exists, just in case
- Consolidate system fixtures into one and add required fields
…gular scope doesn't grant the user permissions to 20+ endpoints.

- This allows us to do things like give system managers permission to just a few endpoints, not all ctl-related resources.
- Rename scopes that would conflict with existing ops scopes
- Add new read scopes to the viewer role
- Remove updating client on login (added last commit).
…efault an empty list to match scopes and roles.

- Add new system-manager-related annotations to db dataset yaml.
- Add tests with correct scopes and incorrect scopes to crud endpoints.
…s and client.scopes columns if the user has cli-objects:-* scopes.

Assert "resource deleted" in crud and system delete responses.
- Fix test for TestGetSystemFromRequestBody which was not getting run.
…stem manager is deleted.

- Clients may still have systems on them, but the user or system doesn't exist so this doesn't seem problematic.
- Refresh client on login so it has the most up-to-date values, especially if they've been adjusted directly in the db.
…aces all the systems the user manages with those in the request body.

- PUT /user/{user_id}/system-manager
- GET /user/{user_id}/system-manager
- GET /user/{user_id}/system-manager/{system_key}
- DELETE /user/{user_id}/system-manager/{system_key}

Adds new system manager scopes.  Adds the read scopes to the viewer role.
…v is set to prod so we can populate all the starter resources.
@pattisdr pattisdr mentioned this pull request Mar 13, 2023
11 tasks
@pattisdr
Copy link
Contributor

There are these role descriptions hanging out on the right with Owner text duplicated in each of them -

Screenshot 2023-03-14 at 10 20 08 AM

@pattisdr
Copy link
Contributor

Looks like we're still using the old mapping in the user summary page. The new role name is "Approver" but in this summary it's being called "Privacy Request Manager", same for "Viewer and Privacy Request Manager."

Product requirements changed during this project and they renamed the roles.

Screenshot 2023-03-14 at 10 57 17 AM

@pattisdr
Copy link
Contributor

I'm assuming this is pre-existing behavior, but the backend only allows the first name and last name of a user to be edited here after it's created, not the username. Should we disable the username from being edited here? It gives the appearance you can edit but you can't. This could be reticketed.

Screenshot 2023-03-14 at 11 04 45 AM

@eastandwestwind
Copy link
Contributor

@pattisdr I went ahead and updated the username form field to be disabled after the user is created
Screenshot 2023-03-14 at 5 18 45 PM

@pattisdr
Copy link
Contributor

Bravo! You're addressing changes faster than I'm finding them.

@pattisdr
Copy link
Contributor

I do think this should be reticketed: Saving changes on ctl datasets when you don't have permissions shows a green popup that you "Success: Successfully modified collection" although the API request returned a 403 and no data changed.

Screenshot 2023-03-14 at 11 22 46 AM

@eastandwestwind
Copy link
Contributor

@pattisdr ticketed here- #2827

@pattisdr
Copy link
Contributor

pattisdr commented Mar 14, 2023

This is looking really good @allisonking and @eastandwestwind.

I've reticketed separate backend work here https://github.com/ethyca/fidesplus/issues/683 for next sprint

This is to avoid too much prop drilling, especially while delete can be called in two different flows
@allisonking
Copy link
Contributor Author

Great work, @eastandwestwind ! I went in and QA'd and fixed up a few things:

  1. It said "Update Password" and "Reset password" which bothered me so I changed it to "Update password" to keep our casing consistent 😎 Also added a success toast on Update password since that wasn't there before (totally out of the scope of this work, but it was easy)
  2. Refactored the delete modal logic a bit so that we don't have to pass the user object all the way down. I recently made a change (maybe it was in this PR...) where we store the activeUser (i.e. the user being edited) in redux, so we can take advantage of that to avoid some prop drilling. Also, before, after you deleted a user, you'd still be left on that user's page (which shouldn't exist anymore) so I added a redirect
  3. There was a sneaky bug where if you went to a user who had a role, i.e. "owner", and then went to another user who had no roles, that user would show up as being an "owner" in the role selection page. This was probably my fault from earlier, but should be fixed now

@eastandwestwind
Copy link
Contributor

eastandwestwind commented Mar 15, 2023

Just added a slight functionality change for better experience.

Before, when deleting a user on their profile page, we stayed on that page, which is misleading because you can no longer edit the user if it doesn't exist.

I'm updating such that we reroute to user management table upon user delete

@eastandwestwind
Copy link
Contributor

Side note: I've noticed some flakiness with the Can edit a system -> Can go through the edit flow cypress test in systems.cy.ts. Sometimes cypress is able to find cy.getByTestId("continue-btn").click();, and sometimes this element doesn't exist, which causes the test to fail.

We'll soon be able to remove this line of code anyway, as it's a known bug, documented here- #2788

For now, though, re-running the test suite seems to work.

@eastandwestwind eastandwestwind force-pushed the aking/fidesplus-641/role-assignment-ui branch from 1ff5847 to 6b0c94d Compare March 15, 2023 15:04
@eastandwestwind
Copy link
Contributor

Reverting to Allison's last commit, since she already covered the reroute to user management page upon user delete!

@eastandwestwind eastandwestwind merged commit d0d6b3c into main Mar 15, 2023
@eastandwestwind eastandwestwind deleted the aking/fidesplus-641/role-assignment-ui branch March 15, 2023 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants