This repository has been archived by the owner on Sep 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix/enterpriseportal: ListEnterpriseSubscriptions fixes (#63412)
Follow-ups to https://github.com/sourcegraph/sourcegraph/pull/63173 I'm running into while working on CORE-169: 1. Intersect permission-allowed subscriptions, instead of always overwriting. I think this is probably desired behaviour, to still allow filtering by subscriptions. If no subscriptions are explicitly listed, _then_ the allowed subscriptions become the set of subscriptions to list. 1. If a permissions filter is used and the resulting subscription set is empty, we fast-exit with empty result 2. If no subscription list is provided, list all subscriptions. This is safe because permission filter has special fast-path above 3. Fix "is archived" support ## Test plan Tests, and a manual check - with `sg start dotcom`, exchange for a token: ```sh sg sams create-client-token \ -sams https://accounts.sgdev.org \ -s 'enterprise_portal::subscription::read' \ -s 'enterprise_portal::codyaccess::read' ``` Query for subscriptions without filters: ```sh curl --header "Content-Type: application/json" --header 'authorization: bearer sams_at_...' --data '{}' http://localhost:6081/enterpriseportal.subscriptions.v1.SubscriptionsService/ListEnterpriseSubscriptions | jq ``` All subscriptions I have locally get returned ✅
- Loading branch information
Showing
9 changed files
with
192 additions
and
65 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
39 changes: 16 additions & 23 deletions
39
cmd/enterprise-portal/internal/subscriptionsservice/mocks_test.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.