enhancement
major
minor
major
minor
major
#29672
TL Views: initial-edit-mode, an object switch and the edit-mode channel enter edit mode without asking <edit-executability>
Problem
<edit-executability> on a <form> is documented to guard entering edit mode wherever it is triggered: FormControl.editPermission() is the condition, and handleEdit() rejects a transition the permission denies. Three other paths enter edit mode by calling FormControl.enterEditMode() directly, without asking editPermission():
- FormElement step 11: initial-edit-mode="true", or an editMode channel already holding true at creation;
- FormControl.handleInputChanged: the re-entry for a new input object when the form is "editable whenever an object is available" (_autoEditMode);
- FormControl.handleEditModeChannelChanged: the editMode channel set to true from outside.
A comment composer (a form with initial-edit-mode over a transient object) is therefore editable for an anonymous session even with <edit-executability><authenticated-only/></edit-executability>. The TL Development app had to hide the whole composer with a <visible-if> instead. Snapshot build 42.
Expected
Every path into edit mode goes through the same permission check. A form whose edit permission is denied stays in view mode (or shows nothing editable), whether the mode comes from the configuration, from an object switch or from the channel.
Lösung
- Die Berechtigungsprüfung sitzt in FormControl.enterEditMode() selbst, dem einzigen Einstieg in den Bearbeitungsmodus. Die Methode liefert zurück, ob das Formular danach bearbeitet wird; ohne Objekt, bei bereits laufender Bearbeitung oder bei verweigerter editPermission() bleibt sie wirkungslos (keine Sperre, kein Overlay). handleEdit() meldet ein false als nicht ausführbar.
- Beim Objektwechsel eines Formulars mit initial-edit-mode wird die Berechtigung gegen das neue Objekt geprüft; ist sie verweigert, zeigt das Formular das neue Objekt im Ansichtsmodus.
- Setzt jemand den editMode-Kanal auf true, obwohl die Berechtigung verweigert ist, schreibt das Formular false zurück: der Kanal spiegelt immer den tatsächlichen Modus.
- Regeln melden keine Änderungen; ein verweigertes Formular betritt den Bearbeitungsmodus nicht von selbst, wenn die Berechtigung später gewährt würde. An- und Abmelden bauen die Sicht ohnehin neu auf.