fix(site): offer every authorized organization in the templates filter - #29054
Open
arpitjain099 wants to merge 1 commit into
Open
fix(site): offer every authorized organization in the templates filter#29054arpitjain099 wants to merge 1 commit into
arpitjain099 wants to merge 1 commit into
Conversation
Signed-off-by: Arpit Jain <[email protected]>
Contributor
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
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.
Closes #28985.
TemplatesFilter's organization dropdown gets its options fromAPI.getMyOrganizations(), which isGET /api/v2/users/me/organizationsand therefore membership-scoped. The tables the filter drives are permission-scoped:TemplatesPagenarrowsuseDashboard().organizationsbyupdateTemplates. A user with template permissions in an organization they are not a member of sees that organization's templates in the table and cannot pick it in the dropdown.Switched to
API.getOrganizations(), which is what the issue suggests and what the rest of the component already assumes:getSelectedOptiona few lines up resolves the organization throughAPI.getOrganization(...)with no membership check, so filtering by such an organization already works if you put it in the URL by hand. Only the picker hid it.New
TemplatesFilter.test.tsxstubs the two endpoints so they disagree, with one organization in both and one only ingetOrganizations, opens the picker, and asserts the non-member organization is offered. Against the current code it fails withand passes with the change.
tsc --noEmitandbiome checkare clean on both files.I left the related
useOrganizationsFilterMenunote in the issue alone. It gates options onaudit_log:read, which is right for the Audit and Connection Log pages and wrong for Workspaces, so the fix there is to make the gate a parameter rather than to drop it, and that felt like a separate change from this one.