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

Introduce UI for Custom Roles #2512

Merged
merged 44 commits into from
May 16, 2024
Merged

Introduce UI for Custom Roles #2512

merged 44 commits into from
May 16, 2024

Conversation

mknowlton89
Copy link
Collaborator

@mknowlton89 mknowlton89 commented May 13, 2024

Features and Changes

Dependencies

Fast Follows (Will complete as separate PRs after this is approved/merged)

  • Add character counter to name/description fields
  • Start using the getConfirmationContent on RoleList's <DeleteButton />
  • Build our deactivate/reactivate flows

Changes from the mock

  • I did increase the character count for a custom role description to be 100 characters (up from 56). Looking at our existing descriptions, the longest of those is 95, so it felt odd to limit it lower than that.

Testing

  • Ensure that free/pro orgs can't create, edit, delete, duplicate, or apply custom roles to users or teams or set the org's default role
  • Ensure that enterprise orgs can create new custom roles
  • Ensure that enterprise orgs can delete custom roles
  • Ensure that enterprise orgs can edit custom roles
  • Ensure that enterprise orgs can duplicate custom roles
  • Ensure that enterprise org can duplicate existing roles
  • Ensure that enterprise orgs can not delete standard roles
  • Ensure that only enterprise orgs can apply custom roles to their users & teams
  • Ensure an org can not create a custom role with an id equal to one of our standard roles
  • Ensure an org can not delete a custom role if there is a user or team using it
  • Ensure an org can not delete a custom role if it is the org's default role
  • Ensure that if an enterprise org downgrades to free or pro, they’re not longer able to add, edit, remove custom roles, nor are they able to add the custom role to any of their new or existing users or teams
  • Ensure that if an enterprise org downgrades to free or pro and the org's default role is a custom role, we reset their default role back to collaborator.

Warning

On the test above, the code in migrations.ts doesn't actually update the org record in mongo. It looks like that isn't called downstream of anything that actually calls updateOrganization. But I can confirm that calling getDefaultRole returns the expected result.

  • Ensure that if a user has a custom role and an org downgrades to free or pro, the user's permissions are still based on the custom role

Screenshots

jdorn and others added 27 commits May 8, 2024 10:59
@mknowlton89 mknowlton89 changed the base branch from main to permission-policies May 14, 2024 16:57
@mknowlton89 mknowlton89 self-assigned this May 14, 2024
@mknowlton89 mknowlton89 marked this pull request as ready for review May 15, 2024 18:27
@mknowlton89 mknowlton89 requested review from msamper and jdorn and removed request for msamper May 15, 2024 18:27
formatOptionLabel={(value) => {
const r = roles.find((r) => r.id === value.label);
if (!r) {
return;
Copy link
Member

@jdorn jdorn May 16, 2024

Choose a reason for hiding this comment

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

Kevin fixed this in a separate PR. We want to do return value.label here (or <strong>{value.label}</strong> instead of returning undefined.

Base automatically changed from permission-policies to main May 16, 2024 13:21
Copy link

github-actions bot commented May 16, 2024

Your preview environment pr-2512-bttf has been deployed.

Preview environment endpoints are available at:

@mknowlton89 mknowlton89 merged commit 4574937 into main May 16, 2024
3 checks passed
@mknowlton89 mknowlton89 deleted the mk/custom-roles-ui branch May 16, 2024 15:19
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.

None yet

2 participants