fix: fix permission handling for component deployment and workload updates#386
Conversation
- Introduced new hooks for managing permissions related to component updates and workload updates. - Updated existing hooks to reflect changes in permission structure, replacing `useDeployPermission` with `useConfigureAndDeployPermission` to check for multiple permissions. - Refactored permission checks in `EnvironmentOverridesPage` and `WorkloadButton` components to incorporate new permission logic. - Updated permission definitions in `permissions.ts` to include `openchoreoReleaseBindingCreatePermission` and `openchoreoWorkloadUpdatePermission`. Signed-off-by: Stefinie Fernando <minolispencer@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthroughThis PR refactors Openchoreo permission management by replacing component deployment permissions with release binding creation permissions, introducing workload update permissions, and creating new React hooks to check these permissions. Existing components are updated to use the refined permission structure. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan for PR comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Purpose
Fix permission handling for component deployment and workload updates
Approach
Updated the deploy permission hook to check for
releasebinding:createpermission instead of dprecatedcomponent:deployThis pull request updates the OpenChoreo permissions model and refines permission checks in the UI. The main changes involve replacing the old component deploy permission with a new release binding permission, introducing a workload update permission, and updating hooks and UI logic to use these new permissions. This allows for more granular and flexible access control in deployment and configuration flows.
Permissions Model Updates:
openchoreoComponentDeployPermissionwithopenchoreoReleaseBindingCreatePermission, updating its name, action, and references throughout the codebase to reflect the new permission for creating release bindings (deploying components). [1] [2] [3] [4] [5] [6]openchoreoWorkloadUpdatePermissionfor updating workload configurations, including its definition and integration into the permissions list and action mapping. [1] [2] [3]React Hooks and Exports:
useComponentUpdatePermission,useWorkloadUpdatePermission, anduseConfigureAndDeployPermissionto check for the new permissions and exported them for use in other components. [1] [2] [3] [4]UI Logic Updates:
EnvironmentOverridesPageto use the new deploy permission hook, ensuring buttons are disabled if the user lacks deploy permission or if the check is still loading. [1] [2] [3] [4]WorkloadButtonto use the new composite hook (useConfigureAndDeployPermission) that enables the button if the user has any of the relevant permissions (deploy, component update, or workload update), and disables it otherwise. [1] [2] [3]Summary by CodeRabbit
Release Notes
New Features
Improvements