[6.x] Hide content nav items with nothing viewable in the selected site - #15384
Open
duncanmcclean wants to merge 2 commits into
Open
[6.x] Hide content nav items with nothing viewable in the selected site#15384duncanmcclean wants to merge 2 commits into
duncanmcclean wants to merge 2 commits into
Conversation
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X9rd5qx6C2eTnQvfvpQqu2
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X9rd5qx6C2eTnQvfvpQqu2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request fixes an issue where the Collections, Navigation and Globals nav items were shown to non-super users in a site where they couldn't view any collections, navs or global sets, leaving a parent item with no children.
This was happening because the parent items are gated by the
indexpolicy, which checks whether the user can view any content in any site, while the child items are filtered down to the selected site.This PR fixes it by letting the
indexpolicy be scoped to a site ($user->can('index', [GlobalSet::class, $site])) and having the CP nav pass the selected site. Callingindexwithout a site behaves as before, so the listing pages are unaffected.Fixes #10152
Related: #9583