diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-31 18:14:30 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-31 18:14:30 +0200 |
| commit | 464af1625349d557f688da9f845471ef8b80a5f9 (patch) | |
| tree | aab415abf115f20ccbcdfad49c27ce5d1bd61134 /config/locales | |
| parent | 8c6a6516e1dc5c1b4f12740a6f7b32765b530bb7 (diff) | |
Gate live-content changes on restricted surfaces
publish_draft!, trash!, destroy_from_trash!, attach_asset! and
Asset#destroy_witnessed! now refuse unless the acting user holds redaktion,
and only when the subject is on a restricted surface: the front page, the
updates tree that feeds ~100k subscribers, or disclosure. Drafting,
autosaving, tagging and creating stay free everywhere for everyone.
Enforcement is in the models rather than the controllers, since attach_asset!
and the rest are reachable from rake tasks and internal paths. It follows the
errors.add-plus-bare-raise pattern the rest of Node already uses, so every
existing RecordInvalid rescue reports it with a localised message; only
assets_controller#destroy needed a rescue added.
A nil user is treated as a system context and bypasses the gate. The default
nil on three of those verbs is what makes that reachable, and removing those
defaults once every call site passes a user is the next tightening.
Diffstat (limited to 'config/locales')
| -rw-r--r-- | config/locales/de.yml | 5 | ||||
| -rw-r--r-- | config/locales/en.yml | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/config/locales/de.yml b/config/locales/de.yml index 8aae7ca5..a7ad0f26 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml | |||
| @@ -145,6 +145,7 @@ de: | |||
| 145 | restore_target_invalid: "Das Wiederherstellungsziel muss ein lebender Node sein" | 145 | restore_target_invalid: "Das Wiederherstellungsziel muss ein lebender Node sein" |
| 146 | destroy_outside_trash: "Nodes können nur aus dem Papierkorb gelöscht werden" | 146 | destroy_outside_trash: "Nodes können nur aus dem Papierkorb gelöscht werden" |
| 147 | attach_in_trash: "An einen Node im Papierkorb können keine Assets angehängt werden" | 147 | attach_in_trash: "An einen Node im Papierkorb können keine Assets angehängt werden" |
| 148 | not_permitted: "In diesem Bereich dürfen nur Mitglieder der Redaktion veröffentlichte Inhalte ändern" | ||
| 148 | user: | 149 | user: |
| 149 | attributes: | 150 | attributes: |
| 150 | roles: | 151 | roles: |
| @@ -153,6 +154,10 @@ de: | |||
| 153 | attributes: | 154 | attributes: |
| 154 | headline: | 155 | headline: |
| 155 | images_and_pdfs_only: "kann nur auf Bildern oder PDFs gesetzt werden" | 156 | images_and_pdfs_only: "kann nur auf Bildern oder PDFs gesetzt werden" |
| 157 | asset: | ||
| 158 | attributes: | ||
| 159 | base: | ||
| 160 | not_permitted: "Dieses Asset ist an geschützte Seiten angehängt; nur die Redaktion darf es löschen" | ||
| 156 | 161 | ||
| 157 | tags: | 162 | tags: |
| 158 | index: | 163 | index: |
diff --git a/config/locales/en.yml b/config/locales/en.yml index e434538f..7e830325 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml | |||
| @@ -92,6 +92,7 @@ en: | |||
| 92 | restore_target_invalid: "Restore target must be a living node" | 92 | restore_target_invalid: "Restore target must be a living node" |
| 93 | destroy_outside_trash: "Nodes are only destroyed from the Trash" | 93 | destroy_outside_trash: "Nodes are only destroyed from the Trash" |
| 94 | attach_in_trash: "Cannot attach assets to a node in the Trash" | 94 | attach_in_trash: "Cannot attach assets to a node in the Trash" |
| 95 | not_permitted: "Only Redaktion members may change published content in this section" | ||
| 95 | user: | 96 | user: |
| 96 | attributes: | 97 | attributes: |
| 97 | roles: | 98 | roles: |
