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

feat: UI graceful handling of restricted permissions for instance related actions [WD-18840] #1094

Merged
merged 1 commit into from
Feb 19, 2025

Conversation

mas-who
Copy link
Contributor

@mas-who mas-who commented Feb 6, 2025

Done

Everything marked as "done" in the "Instances" tab of this spreadsheet

Review changes to be applied (based on discussions from other PR)

  • apply project entitlement queries from images PR [X]
  • adjust entitlement check functions to take resource as input instead of passing it via the hook [X]

QA

  1. Run the LXD-UI:
  2. Perform the following QA steps:
    • Go through every line item in the sheet in the "instances" tab.
    • to make life a bit easier, it's probably a good idea to have the following permissions for this PR (can_view_projects on server; can_view_events on project; can_view_operations on project)

@webteam-app
Copy link

@mas-who mas-who force-pushed the restricted-permissions-instance branch from 80b5ad3 to ed8751b Compare February 6, 2025 08:35
@mas-who mas-who marked this pull request as ready for review February 7, 2025 14:19
@mas-who mas-who changed the title feat: UI graceful handling of restricted permissions for instance related actions feat: UI graceful handling of restricted permissions for instance related actions [WD-18840] Feb 7, 2025
@mas-who mas-who force-pushed the restricted-permissions-instance branch from f7eec10 to ca4a739 Compare February 10, 2025 10:44
@mas-who mas-who force-pushed the restricted-permissions-instance branch 5 times, most recently from 3508ad9 to 07ea391 Compare February 10, 2025 15:18
@mas-who mas-who force-pushed the restricted-permissions-instance branch 4 times, most recently from 3f86d31 to f4c68ba Compare February 10, 2025 18:25
@mas-who mas-who force-pushed the restricted-permissions-instance branch 2 times, most recently from 0a8b453 to 67b9b71 Compare February 12, 2025 15:17
Copy link
Collaborator

@edlerd edlerd left a comment

Choose a reason for hiding this comment

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

Reviewed this partially. Some comments below.

I hope after merging the image permission PR this becomes smaller and easier to handle.

@mas-who mas-who force-pushed the restricted-permissions-instance branch 2 times, most recently from 831836e to eba7f20 Compare February 13, 2025 12:53
Copy link
Collaborator

@edlerd edlerd left a comment

Choose a reason for hiding this comment

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

Read through half of the files, some observations below.

@mas-who mas-who force-pushed the restricted-permissions-instance branch 2 times, most recently from c43c795 to d220376 Compare February 14, 2025 07:59
Copy link
Collaborator

@edlerd edlerd left a comment

Choose a reason for hiding this comment

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

Thanks for the improvements!

Main question now is if we can even have the situation of viewing/creating/editing an instance and not being able to see the other resources like profiles or images. If the answer is no, some of the current changes are not needed, because the conditions will never apply.

@mas-who
Copy link
Contributor Author

mas-who commented Feb 14, 2025

Thanks for the improvements!

Main question now is if we can even have the situation of viewing/creating/editing an instance and not being able to see the other resources like profiles or images. If the answer is no, some of the current changes are not needed, because the conditions will never apply.

We can certainly view/create/edit without permissions to see profiles/images/networks etc. It would be specific things that we can't modify on the instance. For instance creation, without profile permissions means the user would have to create an instance from scratch with no defaults. You can also create an instance without network btw.

@mas-who mas-who force-pushed the restricted-permissions-instance branch from d220376 to 9ba00fc Compare February 14, 2025 11:04
Copy link
Collaborator

@edlerd edlerd left a comment

Choose a reason for hiding this comment

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

Thanks for the improvements, some more observations below. Still didn't get to read through all the code yet.

Copy link
Collaborator

@edlerd edlerd left a comment

Choose a reason for hiding this comment

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

Thanks, this is pretty close, some more comments below. Read through most of the files now.

@mas-who mas-who force-pushed the restricted-permissions-instance branch 2 times, most recently from 464e279 to 6f402ce Compare February 17, 2025 07:19
Copy link
Collaborator

@edlerd edlerd left a comment

Choose a reason for hiding this comment

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

Finished reviewing all the files just now. Some comments below.

@mas-who mas-who force-pushed the restricted-permissions-instance branch from 6f402ce to 7b7cde1 Compare February 17, 2025 18:50
@mas-who
Copy link
Contributor Author

mas-who commented Feb 17, 2025

@edlerd as discussed, the bulk action buttons are now disabled if the user does not have permission manage state for all selected instances on the list page.

@mas-who mas-who force-pushed the restricted-permissions-instance branch 3 times, most recently from 7086eac to e090470 Compare February 18, 2025 14:11
Copy link
Collaborator

@edlerd edlerd left a comment

Choose a reason for hiding this comment

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

Thanks for fixing the bulk case. Looks all right now. Found small things in the instance edit form and some suggestions to simplify.

@mas-who mas-who force-pushed the restricted-permissions-instance branch from e090470 to 8b3ba32 Compare February 18, 2025 15:39
Copy link
Collaborator

@edlerd edlerd left a comment

Choose a reason for hiding this comment

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

Code LGTM, good stuff :)
Still need to do QA, but can also merge as is and improve potential QA as a next iteration to unblock other PRs.

@mas-who
Copy link
Contributor Author

mas-who commented Feb 19, 2025

Code LGTM, good stuff :) Still need to do QA, but can also merge as is and improve potential QA as a next iteration to unblock other PRs.

There are quite a few PRs depending on this one, so I think it'd be good to merge this one now and have follow ups for QA issues.

@mas-who mas-who force-pushed the restricted-permissions-instance branch from 8b3ba32 to ff8e933 Compare February 19, 2025 08:06
@mas-who mas-who merged commit 4cd0ecb into canonical:main Feb 19, 2025
11 checks passed
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