Repository navigation
A/B results: check the right per form - #302
Merged
Merged
Conversation
The results page of an A/B test asked for guild-wide manage rights, while editing and preview of the same form check the right for that form. Someone who manages only some forms could set up an experiment in the builder but not see its results. The forms list, on the other hand, offered the link to everyone who sees the form, reviewers included. The page now uses canManageForm for the form in the URL, and the list shows the link only on rows the viewer manages, like edit and preview.
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.
Problem
forms/[formId]/experiment/page.tsxcheckedcanManageForms(guildId, userId), so it required manage rights on the whole guild. Edit and preview of the same form usecanManageForm(guildId, userId, formId). A manager of only some forms could set up an A/B test in the builder (the form PATCH checks per form), but the results page told them they had no permission.Fix
canManageFormfor the form in the URL.form.managesis set, like edit and preview.Tests
src/test/experiment-page-access.test.tscalls the page with mocked auth, rights, form lookup and dictionary. A per-form manager gets past the check (the form is loaded), someone without the right for this form doesn't.pnpm --filter @msk-forms/web typecheck, eslint and prettier on the changed files.