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

chore: Split UserRoles out of Store #5549

Merged
merged 13 commits into from
Dec 8, 2022
Merged

Conversation

julian-determined-ai
Copy link
Contributor

@julian-determined-ai julian-determined-ai commented Dec 6, 2022

Description

chore: Split UserRoles out of Store WEB-585

This splits UserRoles and UserAssignments into their own store.

Test Plan

  1. Navigate to the WebUI open the console and ensure there are no errors related to permissions.
  2. Activate the rbac feature flag using ?f_rbac=on. Ensure there is a 501 error due to /api/v1/permissions/summary and the UI still loads correctly.

Commentary (optional)

I have removed the initialization of the user roles that was:

  userRoles: [
    {
      id: -10,
      name: 'INITIALIZATION',
      permissions: [],
    },
  ],

please let me know if that needs to be restored.

Checklist

  • Changes have been manually QA'd
    - [ ] User-facing API changes need the "User-facing API Change" label.
    - [ ] Release notes should be added as a separate file under docs/release-notes/.
    See Release Note for details.
    - [ ] Licenses should be included for new code which was copied and/or modified from any external code.

@cla-bot cla-bot bot added the cla-signed label Dec 6, 2022
@netlify
Copy link

netlify bot commented Dec 6, 2022

Deploy Preview for storybook-det ready!

Name Link
🔨 Latest commit ba1894d
🔍 Latest deploy log https://app.netlify.com/sites/storybook-det/deploys/63921e652a7f460008a0996f
😎 Deploy Preview https://deploy-preview-5549--storybook-det.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Dec 6, 2022

Deploy Preview for determined-ui ready!

Name Link
🔨 Latest commit ba1894d
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/63921e65f3965b000988d0c0
😎 Deploy Preview https://deploy-preview-5549--determined-ui.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

</WorkspacesProvider>
</HelmetProvider>
<UserRolesProvider>
<HelmetProvider>
Copy link
Contributor

Choose a reason for hiding this comment

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

small change, but can <UserRolesProvider> be nested inside of <HelmetProvider>?

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe the ordering of this doesn't matter; I saw the Settings.test has this too

@mapmeld
Copy link
Contributor

mapmeld commented Dec 6, 2022

ok it looks like userRoles was initialized for canViewWorkspaces to be true in the brief time between when you arrive on the site, and when you load user roles and permissions. Is there something in the new store which could do this same function? And you could remove the relevant (!!userRoles && userRoles.length === 1 && userRoles[0].id === -10) || from usePermissions.ts

Copy link
Contributor

@mapmeld mapmeld left a comment

Choose a reason for hiding this comment

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

LGTM, noting we think init userRole is no longer needed

@julian-determined-ai julian-determined-ai merged commit 7c58a72 into master Dec 8, 2022
@julian-determined-ai julian-determined-ai deleted the jglover/web-585 branch December 8, 2022 18:43
@@ -28,7 +28,6 @@ interface State {
omnibar: OmnibarState;
};
userAssignments: UserAssignment[];
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a specific reason we want to keep userAssignments in old Store?

@dannysauer dannysauer added this to the 0.19.9 milestone Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants