Skip to content

Ensure lists for resources that don't have schema attributes.verbs LIST aren't shown#16398

Merged
richard-cox merged 8 commits intorancher:masterfrom
richard-cox:fix-unlistable-lists
Feb 16, 2026
Merged

Ensure lists for resources that don't have schema attributes.verbs LIST aren't shown#16398
richard-cox merged 8 commits intorancher:masterfrom
richard-cox:fix-unlistable-lists

Conversation

@richard-cox
Copy link
Copy Markdown
Member

@richard-cox richard-cox commented Jan 20, 2026

Summary

Fixes #15453

Occurred changes and/or fixed issues

  • some resources cannot be listed, for example
    • "ext.cattle.io.passwordchangerequest",
    • "authorization.k8s.io.subjectaccessreview",
    • "authorization.k8s.io.selfsubjectrulesreview",
    • "authorization.k8s.io.selfsubjectaccessreview",
    • "binding",
    • "authentication.k8s.io.tokenreview",
    • "ext.cattle.io.groupmembershiprefreshrequest",
    • "authentication.k8s.io.selfsubjectreview",
    • "authorization.k8s.io.localsubjectaccessreview",
    • "ext.cattle.io.selfuser"
  • Navigating directly to these resources via url (Example /c/local/explorer/authentication.k8s.io.selfsubjectreview)
    • Previously - showed an empty list with forever loading indicator
    • Now - show an error
  • Navigating via the side nav
    • No change (this happens anyway given they have a count of zero)
  • Navigating via the resource search modal
    • Before - these were shown and user could click
    • Now - these are not shown
  • In order to support the ResourceList beforeMount AND fetch in a component with mixins that do NOT contain beforeMount i had to update fetch.client (which overwrites beforeMount if fetch is there)

Areas or cases that should be tested

  • User cannot see resources that cannot be listed in the side bar
  • User cannot see resources that cannot be listed in the cluster explorer resource search
  • When navigating directly to a list that shows resources that cannot be listed we show an appropriate message
    • Example /c/local/explorer/authentication.k8s.io.selfsubjectreview

Areas which could experience regressions

  • spoofed resource lists should show
    • Users & Authentication - Groups
    • Cluster --> Logging --> Filters
  • Lists that have custom components continue to load results
    • cluster explorer --> Workload types
    • cluster management --> clusters
  • Lists that have no custom components continue to load results
    • cluster explorer --> more resources --> authentication providers
    • cluster management --> advanced --> machine deployments

Checklist

  • The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
  • The PR has a Milestone
  • The PR template has been filled out
  • The PR has been self reviewed
  • The PR has a reviewer assigned
  • The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
  • The PR has reviewed with UX and tested in light and dark mode, or there are no UX changes
  • The PR has been reviewed in terms of Accessibility
  • The PR has considered, and if applicable tested with, the three Global Roles Admin, Standard User and User Base

@richard-cox richard-cox added this to the v2.14.0 milestone Jan 20, 2026
@richard-cox richard-cox self-assigned this Jan 20, 2026
@richard-cox richard-cox force-pushed the fix-unlistable-lists branch 2 times, most recently from c729fa5 to 44a8a69 Compare January 21, 2026 16:18
@@ -5,6 +5,12 @@ const hasFetch = (component) => component.$options && typeof component.$options.
export const addLifecycleHook = (vm, hook, fn) => {
if (!vm.$options[hook]) {
vm.$options[hook] = [];
} else if (!Array.isArray(vm.$options[hook]) && typeof vm.$options[hook] === 'function' ) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

without this the fetch would not run in components with beforeMount and mixins which had no beforeMounts


const verbs = schema.attributes?.verbs || [];

if ( !verbs.includes('list') ) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Spoofed lists should always have LIST permissions

@richard-cox richard-cox marked this pull request as ready for review January 26, 2026 15:59
codyrancher
codyrancher previously approved these changes Jan 29, 2026
Copy link
Copy Markdown
Member

@codyrancher codyrancher left a comment

Choose a reason for hiding this comment

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

In the future should we be checking for the get verb or using canList in all the places we're doing permissions with schemaFor?

@richard-cox richard-cox force-pushed the fix-unlistable-lists branch 2 times, most recently from 0056df7 to 8ec2117 Compare February 6, 2026 15:02
@richard-cox richard-cox force-pushed the fix-unlistable-lists branch 2 times, most recently from f712dea to 4724de1 Compare February 12, 2026 14:36
@richard-cox
Copy link
Copy Markdown
Member Author

@codyrancher exactly that. before we just checked if the schema was accessible then assumed all get/list was allowed. going forward we should use the new canGet and updated canList getters. I recently updated the pr with the canGet to solve an issue with the user activity stuff (we were trying to canList a resource which only supported Get), so worth another quick review

codyrancher
codyrancher previously approved these changes Feb 12, 2026
- an alternative was to disable the navigation, however that would involve changes to the same component that handles the side bar
- user activity was broken given
  - we were calling canList on an unlistable resource
    - fixed by creating a new canGet store store getter
  - we were using canList on a norman schema, which used the new steve specific check for attributes
    - fixed by having norman specific canList
- changes
  - move canList and create new canGet in root store
    - their functionality should be the same as before
  - point canList and new canGet to model getters
    - add root canList and canGet that behaved as before
    - add steve specific canList and canGet that looks at attribute verbs
@richard-cox
Copy link
Copy Markdown
Member Author

Note to self, this requires squash merging

@codyrancher
Copy link
Copy Markdown
Member

Note to self, this requires squash merging

Squash with just the ascii art commit message

@codyrancher codyrancher self-requested a review February 13, 2026 21:28
@richard-cox richard-cox merged commit f78e32e into rancher:master Feb 16, 2026
37 checks passed
@richard-cox richard-cox deleted the fix-unlistable-lists branch February 16, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle resources with no LIST methods

2 participants