Skip to content

Restrict instructions to school projects - #479

Merged
loiswells97 merged 5 commits into
mainfrom
restrict-instructions-to-school-projects
Jan 28, 2025
Merged

Restrict instructions to school projects#479
loiswells97 merged 5 commits into
mainfrom
restrict-instructions-to-school-projects

Conversation

@loiswells97

@loiswells97 loiswells97 commented Jan 20, 2025

Copy link
Copy Markdown
Contributor

What's changed?

  • Added extra validation to the project model to stop instructions being added to non-school projects

closes https://github.com/RaspberryPiFoundation/digital-editor-issues/issues/393

@cla-bot cla-bot Bot added the cla-signed label Jan 20, 2025
@raspberrypiherokubot
raspberrypiherokubot temporarily deployed to editor-api-p-restrict-i-zi3sgd January 20, 2025 14:26 Inactive
@loiswells97
loiswells97 temporarily deployed to editor-api-p-restrict-i-zi3sgd January 20, 2025 14:27 Inactive
@loiswells97
loiswells97 temporarily deployed to editor-api-p-restrict-i-zi3sgd January 20, 2025 15:02 Inactive
@loiswells97
loiswells97 temporarily deployed to editor-api-p-restrict-i-zi3sgd January 20, 2025 15:20 Inactive
@loiswells97
loiswells97 merged commit 171fb26 into main Jan 28, 2025
@loiswells97
loiswells97 deleted the restrict-instructions-to-school-projects branch January 28, 2025 16:34
abcampo-iry added a commit that referenced this pull request Aug 11, 2026
## Status

- Partially closes
RaspberryPiFoundation/digital-editor-issues#1657
- Related to
RaspberryPiFoundation/experience-cs#2330

  ## Points for consideration:

- Security: Only users with the `experience-cs-admin` role can change
the project type and Scratch data for public projects.
- Security: Projects are not yet marked as coming from Experience CS.
Until origin tracking is added, only known Experience CS project
identifiers should be enabled for synchronization.

## What's changed?

- Allow public, localized `code_editor_scratch` projects to contain
instructions. This is a narrow exception to [Restrict instructions to
school projects
(#479)](#479)
for public Experience CS templates. This may be worth discussing.
- Allow Experience CS admins to change a public project to
`code_editor_scratch`.
- Allow Experience CS admins to create or update Scratch data through
the project update endpoint.

Some concerns of mine were to understand the cases:

- Existing ExCS stub with no ScratchComponent -> Create ScratchComponent
-> Store the ExCS code -> Change type from scratch to
code_editor_scratch

- Existing ExCS project with a ScratchComponent -> Replace its content
with the latest ExCS code -> This is intentional because ExCS is the
source of truth

- User-owned project -> Cannot be updated by an experience-cs-admin ->
Authorization prevents the overwrite

- Unrelated public project with the same identifier -> Could currently
be overwritten -> This is the known provenance/origin risk mentioned in
the ticket
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants