Skip to content

[9.x] Searchable authorization#797

Merged
duncanmcclean merged 2 commits into9.xfrom
searchable-authorization
Mar 27, 2026
Merged

[9.x] Searchable authorization#797
duncanmcclean merged 2 commits into9.xfrom
searchable-authorization

Conversation

@duncanmcclean
Copy link
Copy Markdown
Member

This pull request fixes an issue where Runway models in the Statamic CP command palette search would fail authorization and then crash.

There were two separate problems:

  • Runway searchables failed authorization checks
    • This was happening because Statamic CP search filters results using User::current()->can('view', $item->getSearchable()), but the Searchable class didn't have a policy registered.
    • I've fixed it by adding a SearchablePolicy that delegates to the existing ResourcePolicy.
  • Runway searchables crashed due to missing getCpSearchResultIcon() method
    • This was happening because Statamic's CP search result rendering expects this method.
    • I've fixed it by adding the method to the Searchable class.

Fixes #796

@duncanmcclean duncanmcclean changed the title Fix Runway searchables in CP command palette search [9.x] Searchable authorization Mar 27, 2026
@duncanmcclean duncanmcclean merged commit 3fa2a64 into 9.x Mar 27, 2026
16 of 17 checks passed
@duncanmcclean duncanmcclean deleted the searchable-authorization branch March 27, 2026 10:20
@github-actions
Copy link
Copy Markdown

Released as part of v9.3.2.

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.

Runway models in Statamic CP command palette search fail authorization and then crash on missing getCpSearchResultIcon()

1 participant