@@ -139,6 +139,7 @@ function xmldb_local_adele_upgrade($oldversion) {
139139 // Adele savepoint reached.
140140 upgrade_plugin_savepoint (true , 2024082905 , 'local ' , 'adele ' );
141141 }
142+
142143 if ($ oldversion < 2025081200 ) {
143144 // Define the new "Adele Assistant" role properties.
144145 $ name = 'Adele Assistant ' ;
@@ -195,20 +196,6 @@ function xmldb_local_adele_upgrade($oldversion) {
195196 // Update savepoint to mark the successful upgrade.
196197 upgrade_plugin_savepoint (true , 2025081200 , 'local ' , 'adele ' );
197198 }
198- if ($ oldversion < 2026061800 ) {
199- // Ticket #431: the local/adele:teacheredit capability gained the editingteacher
200- // archetype so editing-teachers can operate master conditions without the
201- // over-broad local/adele:canmanage. Archetype defaults only apply to fresh
202- // installs, so grant it to existing editing-teacher roles here too. Do not
203- // overwrite any explicit admin override (overwrite = false).
204- $ systemcontext = \context_system::instance ();
205- foreach (get_archetype_roles ('editingteacher ' ) as $ role ) {
206- assign_capability ('local/adele:teacheredit ' , CAP_ALLOW , $ role ->id , $ systemcontext ->id , false );
207- }
208-
209- // Adele savepoint reached.
210- upgrade_plugin_savepoint (true , 2026061800 , 'local ' , 'adele ' );
211- }
212199
213200 if ($ oldversion < 2026071500 ) {
214201 // Ticket #482: the local/adele:teacheredit capability gained the manager
@@ -224,6 +211,22 @@ function xmldb_local_adele_upgrade($oldversion) {
224211 // Adele savepoint reached.
225212 upgrade_plugin_savepoint (true , 2026071500 , 'local ' , 'adele ' );
226213 }
214+
215+ if ($ oldversion < 2026061800 ) {
216+ // Ticket #431: the local/adele:teacheredit capability gained the editingteacher
217+ // archetype so editing-teachers can operate master conditions without the
218+ // over-broad local/adele:canmanage. Archetype defaults only apply to fresh
219+ // installs, so grant it to existing editing-teacher roles here too. Do not
220+ // overwrite any explicit admin override (overwrite = false).
221+ $ systemcontext = \context_system::instance ();
222+ foreach (get_archetype_roles ('editingteacher ' ) as $ role ) {
223+ assign_capability ('local/adele:teacheredit ' , CAP_ALLOW , $ role ->id , $ systemcontext ->id , false );
224+ }
225+
226+ // Adele savepoint reached.
227+ upgrade_plugin_savepoint (true , 2026061800 , 'local ' , 'adele ' );
228+ }
229+
227230 if ($ oldversion < 2026072200 ) {
228231 // The course_completed observer now resolves the affected student via
229232 // relateduserid instead of the acting user (userid). Courses that were
@@ -267,6 +270,6 @@ function xmldb_local_adele_upgrade($oldversion) {
267270 }
268271
269272 upgrade_plugin_savepoint (true , 2026072203 , 'local ' , 'adele ' );
270-
273+ }
271274 return true ;
272275}
0 commit comments