feat(marketplace): typed allow-list gate with open-to-everyone toggle#8485
Open
LWS49 wants to merge 11 commits into
Open
feat(marketplace): typed allow-list gate with open-to-everyone toggle#8485LWS49 wants to merge 11 commits into
LWS49 wants to merge 11 commits into
Conversation
InstanceUser is acts_as_tenant-scoped, so the instance_users subquery in grants_access? only sees the current tenant: an instance rule grants that instance's users access while browsing it, not membership-based access everywhere. The model comment claimed the opposite; fix it and add a characterization spec for the cross-instance case.
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.
Summary
Marketplace visibility is currently all-or-nothing, which blocks a staged rollout. This PR gates the marketplace behind a global typed allow-list: course managers/owners only see it if a rule matches them (specific user, whole instance, or email domain), while system administrators always retain access. It adds a self-serve System::Admin page to manage the rules, and a deliberate, reversible "open to everyone" mode that opens the marketplace to all course managers everywhere in one action without discarding the scoped rules built up during the staged rollout.
Design decisions
rule_typeenum (user / instance / email_domain / everyone) - a single pool keeps administration in one place, and instance rules still scope per-instance naturally because the match goes throughuser.instance_users, which is tenant-scoped at query timeeveryonerow, disable deletes it, so scoped rules survive a temporary opening untouched and the existing create/destroy endpoints are reused with no new routeseveryonerow, enforced by a model uniqueness validation paired with a partial unique DB indexRegression prevention
grants_access?matching for user rules, instance rules (including per-instance scoping under the current tenant), case-insensitive email-domain rules, the everyone rule, and nil-user denialeveryoneRuleId, everyone row excluded from the scoped list), and rejection of a second everyone rule with 400