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 requests UI #222

Merged
merged 18 commits into from
Jan 23, 2025
Merged

Role requests UI #222

merged 18 commits into from
Jan 23, 2025

Conversation

eguerrant
Copy link
Contributor

@eguerrant eguerrant commented Jan 8, 2025

Adding in Role Requests to the Access UI

In this PR, I:

  • Updated the Role Requests API so that blocked roles aren't shown to blocked owners and are forwarded to Access admins as needed
  • Created a UI for Role Request creation, list, and viewing/response
  • Fixed various bugs I found along the way (including on non-role requests pages)

General Workflow

If you own at least one role, a 'Create a request button' will be shown. You will have the option to choose for which of the roles you own you'd like to make a request, to which non-role group you'd like the role to be added to, membership/ownership, an amount of time for access, and the ability to provide a reason.

Owners or admins should be notified on role request creation.

Owners who are not blocked by group tag constraints can respond to the request. If the owner is blocked, a note will be shown.

If all group owners are blocked, Access admins will need to respond to the request. The request is added to admins' 'Assigned to me' list and a note is shown that all owners are blocked on the request page.

After a decision is made on the request, the requester is notified of the decision.

Screenshot 2025-01-08 at 3 50 58 PM

401343958-656c4e01-e795-498a-86cd-78d23bedb92b

Screenshot 2025-01-08 at 3 49 56 PM

Regular role request read page:
401344617-e02b54dc-24c7-4e8c-adcf-17e0a1cc3336

Viewing role members who will be added if the request is approved:
401345444-287a637f-d42e-4cf5-928d-cb705bc67ef0

Blocked owner role request read page:
401343793-f8c78f6a-61cf-4467-adc6-b664a30952d9

Admin view all owners blocked request read page:
401343840-dc1bbadd-9bc2-4f76-96b5-977d986b457b

@eguerrant eguerrant marked this pull request as ready for review January 9, 2025 22:46
savathoon
savathoon previously approved these changes Jan 16, 2025
Copy link
Contributor

@savathoon savathoon left a comment

Choose a reason for hiding this comment

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

LGTM, some nits but no blockers. Might follow up to add a style linter to migrate to === and !== for behavior consistency...eventually...

src/pages/role_requests/RoleMembers.tsx Outdated Show resolved Hide resolved
)}
</TableCell>
<TableCell>
{row.resolver == null && row.status != 'PENDING' ? (
Copy link
Contributor

Choose a reason for hiding this comment

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

nit - this ternary operator chain should be a function that returns a component instead of inline for readability and/or if someone wants to add a new condition but NAB

Copy link
Collaborator

Choose a reason for hiding this comment

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

Unless we're doing this multiple times on the page, I think an inline ternary is more readable instead of jumping back to read the function. Although, I'm onboard if we want to make multiple sub-component functions instead of a giant component return statement (which is what we normally do in Access and probably an antipatterm). Agree it's not a blocker, but definitely a nice-to-have refactor for readability which we can always do later.

src/pages/role_requests/List.tsx Outdated Show resolved Hide resolved
return params;
});
setRowsPerPage(parseInt(event.target.value, 10));
setPage(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

I know the other search pages work similarly, but how would you feel about clearing all of the search params instead of setting the page explicitly to page 0? There's some inconsistent behavior I've noticed elsewhere due to this 🤷 NAB but was planning to make changes along this line at some later point

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll probably leave this for now since (while maybe not ideal, I have no idea what front end best practices are) it's consistent with most of the other pages

src/pages/role_requests/List.tsx Show resolved Hide resolved
{props.groupName}.
</Typography>
{props.rows.length == 0 ? (
<Typography sx={{mt: 2}}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This could probably be a little prettier. Maybe break up into multiple lines so the dialog isn't super wide? Also maybe insert a Divider or something to separate out the text from the headers?

Screenshot 2025-01-21 at 6 16 58 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Better..? I made the dialog narrower and changed up the wording/colors/spacing a little but idk about how to make it pretty

Screenshot 2025-01-21 at 3 47 46 PM

if blocked:
blocked_requests.append(req.id)

query = query.join(RoleRequest.requested_group).filter(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this work to combine this Access admin query with the query below or should this query be executed and stored as a list that gets appended to the output of the query below?

Copy link
Contributor Author

@eguerrant eguerrant Jan 22, 2025

Choose a reason for hiding this comment

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

It was actually right before I made any of the recent changes since the admin part of the if/else factored in owned groups and apps in addition to blocked requests. Removing the else just complicated achieving the same thing. Just reverted it.

@eguerrant eguerrant merged commit 386e494 into main Jan 23, 2025
6 checks passed
@eguerrant eguerrant deleted the role_requests_ui branch January 23, 2025 01:03
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.

3 participants