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

Add page for listing Group members #973

Merged
merged 9 commits into from
Aug 15, 2024
Merged

Add page for listing Group members #973

merged 9 commits into from
Aug 15, 2024

Conversation

joverlee521
Copy link
Contributor

@joverlee521 joverlee521 commented Aug 6, 2024

Description of proposed changes

The new page is available at groups/<groupName>/settings/members. I chose to use the same URL as the API so that we don't have to take up another namespace (e.g. groups/<groupName>/members). The main Group page will only link out to the members page if the current user is authorized to list Group members.

The members list only displays the most privileged role for each member to keep the display simple. It assumes the group roles API returns the roles in the order from least to most privileged.

The plan is to make future changes to this page to allow Group owners to edit members here as well. I'm making that a separate change to keep this PR simple.

Related issue(s)

Related to #804

Checklist

Simplifying conditionals in preparation for adding another dynamic route
for a group members page.
I was looking into tackling the TODO comment for the location prop¹ in
the groups JS routing. The location prop was being passed around to be
used in the NavBar component, but the use of it was removed in a
recent refactoring.² So just remove all of the unused `location` props
for the `NavBar` and the `GenericPage` components.

¹ <https://github.com/nextstrain/nextstrain.org/blob/1aeb1e499b9f25d9a918465fd3450fca51f40a2d/static-site/pages/groups/%5B...groupName%5D.jsx#L22>
² <ac12e32>
The OPTIONS method was included in the RESTful API docs¹ for the new
Groups membership routes, but were not added to the routes themselves.

I will be using this in future changes to check user permissions for
viewing and editing Group members.

¹ <84a7374#diff-676fb03989c04d3661eac5e82cb55fc6a9f43df70bd94565535ba509e12f0c64>
The new page is available at `groups/<groupName>/settings/members`.
I chose to use the same URL as the API so that we don't have to take
up another namespace (e.g. `groups/<groupName>/members`). The main Group
page will only link out to the members page if the current user is
authorized to list Group members.

The members list only displays the most privileged role for each member
to keep the display simple. It assumes the group roles API returns the
roles in the order from least to most privileged.
@nextstrain-bot nextstrain-bot temporarily deployed to nextstrain-s-list-group-iskq5r August 6, 2024 00:46 Inactive
- remove unused `props`
- remove unnecessary semicolons
@joverlee521 joverlee521 temporarily deployed to nextstrain-s-list-group-iskq5r August 6, 2024 00:54 Inactive
@victorlin victorlin self-requested a review August 6, 2024 22:26
Copy link
Member

@victorlin victorlin left a comment

Choose a reason for hiding this comment

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

The page loads fine in local testing, so consider everything non-blocking.

My suggestions are largely influenced by GitHub's design on https://github.com/orgs/nextstrain/people

static-site/src/sections/group-members-page.tsx Outdated Show resolved Hide resolved
static-site/src/sections/group-members-page.tsx Outdated Show resolved Hide resolved
static-site/src/sections/group-members-page.tsx Outdated Show resolved Hide resolved
@joverlee521 joverlee521 temporarily deployed to nextstrain-s-list-group-iskq5r August 9, 2024 23:31 Inactive
@tsibley
Copy link
Member

tsibley commented Aug 13, 2024

not a full review, but passing comment

The members list only displays the most privileged role for each member to keep the display simple. It assumes the group roles API returns the roles in the order from least to most privileged.

This feels fragile. It makes the display (and eventual management UI) at odds with the realities of our data model, which leaves a space for bugs to lurk. I think it's particularly important to represent the data model accurately when dealing with permissions/ACLs/security/etc.

@joverlee521 joverlee521 temporarily deployed to nextstrain-s-list-group-iskq5r August 13, 2024 22:36 Inactive
@joverlee521
Copy link
Contributor Author

not a full review, but passing comment

The members list only displays the most privileged role for each member to keep the display simple. It assumes the group roles API returns the roles in the order from least to most privileged.

This feels fragile. It makes the display (and eventual management UI) at odds with the realities of our data model, which leaves a space for bugs to lurk. I think it's particularly important to represent the data model accurately when dealing with permissions/ACLs/security/etc.

Thanks for flagging @tsibley, I agree this can be fragile if we ever decide to update the Group roles. Is the suggestion to update the UI to display multiple roles or to update the data model to only allow users to be a part of one role?

I'm personally leaning towards updating the data model to a single role per user per group (unless there was a specific reason to allow a member to have multiple roles). This seems to be inline with the current provision script which removes the user from other roles when they get assigned a new role.

@tsibley
Copy link
Member

tsibley commented Aug 14, 2024

Update the UI to display multiple roles. Updating the data model is not trivial/possible, as users can inherently be in multiple Cognito groups and we can't control that. I never saw that as a problem because RBAC is inherently multi-role and we could easily have reasons to use more than the basic three we started with.

@joverlee521 joverlee521 temporarily deployed to nextstrain-s-list-group-iskq5r August 14, 2024 20:24 Inactive
@joverlee521
Copy link
Contributor Author

Update the UI to display multiple roles.

Updated in 027910d:

Screenshot 2024-08-14 at 1 25 36 PM

If there's no other feedback, I'll merge this tomorrow.

@joverlee521 joverlee521 merged commit abbe91c into master Aug 15, 2024
7 checks passed
@joverlee521 joverlee521 deleted the list-group-members branch August 15, 2024 20:02
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.

5 participants