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

Task/multiple roles groups #4512

Merged
merged 20 commits into from
Aug 25, 2023
Merged

Task/multiple roles groups #4512

merged 20 commits into from
Aug 25, 2023

Conversation

chriswk
Copy link
Contributor

@chriswk chriswk commented Aug 16, 2023

https://linear.app/unleash/issue/2-1128/change-the-api-to-support-adding-multiple-roles-to-a-usergroup-on-a
https://linear.app/unleash/issue/2-1125/be-able-to-fetch-all-roles-for-a-user-in-a-project
https://linear.app/unleash/issue/2-1127/adapt-the-ui-to-be-able-to-do-a-multi-select-on-role-permissions-for

  • Allows assigning project roles to groups with root roles
  • Implements new methods that support assigning, editing, removing and retrieving multiple project roles in project access, along with other auxiliary methods
  • Adds new events for updating and removing assigned roles
  • Adapts useProjectApi to new methods that use new endpoints that support multiple roles
  • Adds the multipleRoles feature flag that controls the possibility of selecting multiple roles on the UI
  • Adapts ProjectAccessAssign to support multiple role, using the new methods
  • Adds a new MultipleRoleSelect component that allows you to select multiple roles based on the RoleSelect component
  • Adapts the RoleCell component to support either a single role or multiple roles
  • Updates the access.spec.ts Cypress e2e test to reflect our new logic
  • Updates access-service.e2e.test.ts with tests covering the multiple roles logic and covering some corner cases
  • Updates project-service.e2e.test.ts to adapt to the new logic, adding a test that covers adding access with [roles], [groups], [users]
  • Misc refactors and boy scouting

image

@vercel
Copy link

vercel bot commented Aug 16, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 24, 2023 1:49pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Aug 24, 2023 1:49pm

cy.get(`[data-testid='${PA_ASSIGN_CREATE_ID}']`).click();
cy.wait('@editAccess');
cy.get("td span:contains('Owner')").should('have.length', 2);
cy.get("td span:contains('2 roles')").should('have.length', 1);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 , actual readable tests.

Comment on lines +449 to +465
<MultipleRoleSelect
data-testid={PA_ROLE_ID}
roles={roles}
value={selectedRoles}
setValue={setRoles}
/>
)}
elseShow={() => (
<RoleSelect
data-testid={PA_ROLE_ID}
roles={roles}
value={selectedRoles[0]}
setValue={role =>
setRoles(role ? [role] : [])
}
/>
)}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice way of using the flag to turn it on/off :)

Comment on lines -162 to +142
try {
const res = await makeRequest(req.caller, req.id);

return res;
} catch (e) {
throw e;
}
return await makeRequest(req.caller, req.id);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good boyscouting here, why try-catch when we're just rethrowing :)

Copy link
Member

@nunogois nunogois left a comment

Choose a reason for hiding this comment

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

🟢 from @chriswk

@nunogois nunogois merged commit 21b4ada into main Aug 25, 2023
15 of 16 checks passed
@nunogois nunogois deleted the task/multipleRolesGroups branch August 25, 2023 08:31
nunogois added a commit that referenced this pull request Sep 5, 2023
Does what it says on the tin, should help with cleaning up
#4512 and respective schema
changes.

---------

Co-authored-by: Gastón Fournier <gaston@getunleash.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants