Skip to content

feat: [UIE-8935] - IAM RBAC: permission check for linode configurations tab#12447

Merged
corya-akamai merged 6 commits intolinode:developfrom
aaleksee-akamai:UIE-8935-linodes-tab-configurations
Jul 8, 2025
Merged

feat: [UIE-8935] - IAM RBAC: permission check for linode configurations tab#12447
corya-akamai merged 6 commits intolinode:developfrom
aaleksee-akamai:UIE-8935-linodes-tab-configurations

Conversation

@aaleksee-akamai
Copy link
Contributor

Description 📝

Implement the new RBAC permission hook in Linodes configuration tab

Changes 🔄

  1. Permissions Refactor
    Replaced usage of useRestrictedGlobalGrantCheck and related grant checks with a new usePermissions hook throughout Linodes configuration tab
    All permission checks for editing, cloning, adding, rebooting, and deleting linode configs now use the new usePermissions API, improving consistency and maintainability.

  2. Test Coverage
    Added new tests for permission-based UI states:
    Tests for enabling/disabling the "Add Configuration" button and submit button based on user permissions.
    Added tests for the LinodeConfigActionMenu to verify that action items are enabled/disabled according to permissions.

  3. Files Affected:

  • LinodeConfigs.tsx + LinodeConfigs.test.tsx
  • LinodeConfigActionMenu.tsx + LinodeConfigActionMenu.test.tsx (new test file)
  • ConfigRow.tsx
  • LinodeConfigDialog.tsx & LinodeConfigDialog.test.tsx
  • InterfaceSelect.tsx + InterfaceSelect.test.tsx

Target release date 🗓️

July 9th

Preview 📷

Before After
image image

How to test 🧪

Prerequisites

(How to setup test environment)

  • devcloud IAM account or local devenv setup or mock data

Verification steps

(How to verify changes)

  • Confirm the buttons are disabled according the grant model with IAM is off, and according to the RBAC model when IAM is on.
Author Checklists

As an Author, to speed up the review process, I considered 🤔

👀 Doing a self review
❔ Our contribution guidelines
🤏 Splitting feature into small PRs
➕ Adding a changeset
🧪 Providing/improving test coverage
🔐 Removing all sensitive information from the code and PR description
🚩 Using a feature flag to protect the release
👣 Providing comprehensive reproduction steps
📑 Providing or updating our documentation
🕛 Scheduling a pair reviewing session
📱 Providing mobile support
♿ Providing accessibility support


  • I have read and considered all applicable items listed above.

As an Author, before moving this PR from Draft to Open, I confirmed ✅

  • All unit tests are passing
  • TypeScript compilation succeeded without errors
  • Code passes all linting rules

@aaleksee-akamai aaleksee-akamai requested a review from a team as a code owner June 30, 2025 14:19
@aaleksee-akamai aaleksee-akamai requested review from cpathipa and mjac0bs and removed request for a team June 30, 2025 14:19
@aaleksee-akamai aaleksee-akamai self-assigned this Jun 30, 2025
@aaleksee-akamai aaleksee-akamai force-pushed the UIE-8935-linodes-tab-configurations branch from 0fde0e4 to 3b08c5e Compare June 30, 2025 14:20
@aaleksee-akamai aaleksee-akamai added Linodes Dealing with the Linodes section of the app IAM (Identity & Access Management) labels Jun 30, 2025
textFieldProps={{
disabled: readOnly,
}}
// textFieldProps={{
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this in future ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, I've forgot that, thanks!

@cpathipa cpathipa added the Add'tl Approval Needed Waiting on another approval! label Jun 30, 2025
Copy link
Contributor

@mjac0bs mjac0bs left a comment

Choose a reason for hiding this comment

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

Thanks @aaleksee-akamai - approving for the functionality and code review, but tests need to pass before merging this. The linode-config.spec.ts failures are relevant. I think we'll need to mock the correct permissions there, because the tests are trying to access aspects of the UI that are now disabled with these changes.

Screenshot 2025-07-01 at 2 12 47 PM

Confirmed that the different linode config actions are enabled/disabled via mocks. For anyone else testing this with mocks in the future:

  • Legacy MSW
  • Updated response to enable all the buttons in serverHandlers.ts:
  http.get('*/iam/users/:username/permissions/:entity_type/:entity_id', () => {
    return HttpResponse.json([
      'reboot_linode',
      'view_linode',
      'update_linode_config_profile',
      'clone_linode',
      'delete_linode_config_profile',
      'create_linode_config_profile',
    ]);
  }),

@github-project-automation github-project-automation bot moved this from Review to Approved in Cloud Manager Jul 1, 2025
@aaleksee-akamai
Copy link
Contributor Author

Thanks @aaleksee-akamai - approving for the functionality and code review, but tests need to pass before merging this. The linode-config.spec.ts failures are relevant. I think we'll need to mock the correct permissions there, because the tests are trying to access aspects of the UI that are now disabled with these changes.

Screenshot 2025-07-01 at 2 12 47 PM

Confirmed that the different linode config actions are enabled/disabled via mocks. For anyone else testing this with mocks in the future:

  • Legacy MSW
  • Updated response to enable all the buttons in serverHandlers.ts:
  http.get('*/iam/users/:username/permissions/:entity_type/:entity_id', () => {
    return HttpResponse.json([
      'reboot_linode',
      'view_linode',
      'update_linode_config_profile',
      'clone_linode',
      'delete_linode_config_profile',
      'create_linode_config_profile',
    ]);
  }),

Just in case - you always can use the presets for User Permissions:

image

@jdamore-linode
Copy link
Contributor

jdamore-linode commented Jul 3, 2025

Hey @aaleksee-akamai, don't hesitate to ping us in #cloud-manager or ping me directly if you need any help tackling these tests 👍

@cpathipa cpathipa added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! labels Jul 3, 2025
@mjac0bs mjac0bs added the Related Cypress Test Failure Test failure(s) are the result of changes in this PR and must be addressed before merging. label Jul 3, 2025
@cpathipa
Copy link
Contributor

cpathipa commented Jul 3, 2025

@aaleksee-akamai When the flag is disabled the config button is disable and there is no way user can add their configurations.
image

@jaalah-akamai jaalah-akamai added 🚨 Urgent and removed Approved Multiple approvals and ready to merge! labels Jul 7, 2025
@corya-akamai corya-akamai self-requested a review July 7, 2025 19:51
@aaleksee-akamai aaleksee-akamai force-pushed the UIE-8935-linodes-tab-configurations branch from 0913311 to 1fe459c Compare July 8, 2025 11:06
@corya-akamai corya-akamai requested a review from a team as a code owner July 8, 2025 14:40
@corya-akamai corya-akamai requested review from dmcintyr-akamai and removed request for a team July 8, 2025 14:40
Copy link
Contributor

@jdamore-linode jdamore-linode left a comment

Choose a reason for hiding this comment

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

Thanks @aaleksee-akamai and @corya-akamai! Approved pending CI, but linode-config.spec.ts and upgrade-linode-interfaces.spec.ts both passed locally so I'm expecting it to succeed 👍 thanks again!

@linode-gh-bot
Copy link
Collaborator

Cloud Manager UI test results

🔺 1 failing test on test run #11 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
1 Failing673 Passing5 Skipped119m 38s

Details

Failing Tests
SpecTest
object-storage.e2e.spec.tsCloud Manager Cypress Tests→object storage end-to-end tests » object storage end-to-end tests

Troubleshooting

Use this command to re-run the failing tests:

pnpm cy:run -s "cypress/e2e/core/objectStorage/object-storage.e2e.spec.ts"

@corya-akamai corya-akamai merged commit 98ba38a into linode:develop Jul 8, 2025
34 of 35 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Merged in Cloud Manager Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

IAM (Identity & Access Management) Linodes Dealing with the Linodes section of the app Related Cypress Test Failure Test failure(s) are the result of changes in this PR and must be addressed before merging. 🚨 Urgent

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

7 participants