Repository navigation
Gate survey and live-poll staff actions on manage_surveys and run_polls - #1300
Open
DavidCzartoryski wants to merge 13 commits into
Open
DavidCzartoryski wants to merge 13 commits into
DavidCzartoryski wants to merge 13 commits into
Conversation
…ls (#1010) Move survey and live-poll writes onto capabilities so instructors can turn each action off for a role, without changing day-one access for instructors or default graders. Co-authored-by: Cursor <cursoragent@cursor.com>
Record day-one seeding, what each capability covers, and which survey/poll rules stay views or student-facing. Co-authored-by: Cursor <cursoragent@cursor.com>
Assert custom-role allow/deny, default grader day-one access, student responses, cross-class isolation, and hidden management controls without each capability. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 1
Please check the settings in the CodeRabbit UI or the
|
Co-authored-by: Cursor <cursoragent@cursor.com>
…es (#1010) Co-authored-by: Cursor <cursoragent@cursor.com>
…#1010) Co-authored-by: Cursor <cursoragent@cursor.com>
…rects (#1010) Co-authored-by: Cursor <cursoragent@cursor.com>
…1010) Co-authored-by: Cursor <cursoragent@cursor.com>
…ts (#1010) Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
DavidCzartoryski
had a problem deploying
to
report-unmask-review
November 16, 2026 06:12 — with
GitHub Actions
Error
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
Co-authored-by: Cursor <cursoragent@cursor.com>
…1010) Co-authored-by: Cursor <cursoragent@cursor.com>
DavidCzartoryski
had a problem deploying
to
report-unmask-review
November 16, 2026 07:09 — with
GitHub Actions
Error
DavidCzartoryski
marked this pull request as ready for review
November 16, 2026 13:06
DavidCzartoryski
requested a deployment
to
report-unmask-review
November 16, 2026 13:07 — with
GitHub Actions
Waiting
This branch is waiting to be deployed
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.
Part of #1010. Stacked on #1299, which is stacked on #1286.
Agent: Cursor wrote this; nothing was run locally, CI is the first test run. GPT-6.1 Sol reviewed three times by reading; its findings are addressed in the later commits. CI passed on
a9593067(lint, unit-test job,e2e-local); the new commit awaits CI.What changed
Adds
manage_surveysandrun_polls, puts them on the right default roles (and existing custom roles forrun_polls), and switches survey/live-poll staff writes in RLS, RPCs, and management UI to those capabilities. Student survey/poll flows and staff views stay as they were.surveys.copykeeps today's grader class-access check so default graders do not lose CLI copy on day one.Why
Instructors should be able to decide which TAs can manage surveys or run live polls, without changing what instructors and default graders can do on day one.
How
surveysINSERT (surveys_insert_instructors)manage_surveyssurveysUPDATE (surveys_update_instructors)manage_surveyssurveysSELECT staff / studentssurvey_assignmentsINSERTmanage_surveys+can_manage_survey_in_class(new values must point at a survey of the same class)survey_assignmentsUPDATEmanage_surveysin the row's class; WITH CHECK:manage_surveys+can_manage_survey_in_class(so existing mismatched rows can be repaired, but cannot be saved pointing at another class's survey)survey_assignmentsDELETEmanage_surveysin the row's class only (a manager can delete a legacy mismatched row)survey_assignmentsSELECT (assignee / graders / instructors)survey_templatesINSERT / UPDATEmanage_surveyssurvey_templatesSELECTsurvey_templatesDELETEmanage_surveys)survey_seriesINSERT / UPDATE / DELETE (was FOR ALL instructor)manage_surveyssurvey_seriesSELECTcreate_survey_assignmentsmanage_surveyssoft_delete_surveymanage_surveysreorder_surveys_in_seriesmanage_surveyssurvey_responsesINSERT / UPDATE / SELECTlive_pollsINSERT / UPDATE / DELETErun_pollslive_pollsSELECT live / stafflive_poll_responsesstaff INSERT / UPDATE / DELETE (was FOR ALL)run_pollslive_poll_responsesstaff SELECT (split out)run_pollscan read and cannot change)live_poll_responsesstudent/anon INSERTcan_access_poll_responsecan_respond_to_surveypolls/poll_questions/ …20251213200333_surveys_polls.sql; nothing left to migratesurveys.copyassertUserCanAccessClasscan_manage_survey_in_class(survey_id, class_id)is SECURITY DEFINER sosurvey_assignmentsINSERT and UPDATE WITH CHECK can check the parent survey without re-entering surveys RLS (surveys_select_studentsreadssurvey_assignments). It returns true only when the survey belongs to the class and the caller holdsmanage_surveysthere, so/rpccannot leak survey/class membership to an unrelated signed-in user. UPDATE USING and DELETE USING omit the helper so amanage_surveysholder in the row's class can repair or delete a legacy row whosesurvey_idandclass_iddisagree.surveysINSERT / UPDATE stay the capability check alone. They do not requireseries_idto match the survey's class: CLIsurveys.copykeeps the sourceseries_idwhen copying into another class, and a same-class series check would block instructors from saving those rows.seed_default_class_roles()still seedsmanage_flashcardsfor graders and now also seedsrun_polls.manage_surveysis instructor-only (existing classes get an explicit insert; new classes get it from the instructor CROSS JOIN).Authoring pages (
surveys/new,surveys/.../edit,polls/new) and poll Start/Stop useuseCapabilityOnceLoaded/useCapabilityso a custom role with the capability is not bounced by an old grader role check.Tests
Written, not run locally:
GRADER_SEEDED_CAPABILITIESincludesrun_polls.manage_surveysin A can manage A assignments; refused whenclass_id = Apoints at a B survey; retargeting an A assignment to a B survey raises 42501; any write to B's assignments is refused.class_id = Arows pointing at a B survey; amanage_surveysholder in A can delete one and retarget another to an A survey.can_manage_survey_in_class): student of class B getsfalsefor an A survey with A's class id;manage_surveysholder in A getstruefor an A survey andfalsefor a B survey with A's class id.Permission denied: manage_surveys requiredmessage.run_pollscan SELECT; UPDATE/DELETE leave the row unchanged; student can still answer.manage_surveys; custom-role grader with it opens new/edit; default grader and custom-role grader without it are redirected; Create / Open / Delete poll controls hide withoutrun_polls; Start/Stop hidden (after Present is visible) and new-poll redirected without it; default grader (hasrun_polls) sees them.Open questions
surveys copy(one or all, keeping the source status) withoutmanage_surveys.assignments copyneeds an instructor in the target class, so linked-survey copying there is not a grader path. Creating a survey in the app needsmanage_surveys. Shouldsurveys copyrequiremanage_surveyson both classes? That would take it away from default graders.series_id). That predates this PR and is left for a follow-up.Made with Cursor