There can be a scenario when default admin user is not a site admin.
In this case finishing outage from CLI throws an exception:
root@4a39699bdb9d:/var/www/site# php auth/outage/cli/finish.php --active
Default exception handler: Sorry, but you do not have permission to update the calendar event. Debug:
Error code: nopermissiontoupdatecalendar
* line 494 of /lib/setuplib.php: moodle_exception thrown
* line 592 of /calendar/lib.php: call to print_error()
* line 68 of /auth/outage/classes/calendar/calendar.php: call to calendar_event->update()
* line 134 of /auth/outage/classes/dml/outagedb.php: call to auth_outage\calendar\calendar::update()
* line 297 of /auth/outage/classes/dml/outagedb.php: call to auth_outage\dml\outagedb::save()
* line 97 of /auth/outage/classes/local/cli/finish.php: call to auth_outage\dml\outagedb::finish()
* line 35 of /auth/outage/cli/finish.php: call to auth_outage\local\cli\finish->execute()
Steps to replicate:
Create user newadmin.
Set newadmin as a new main admin.
Login as newadmin.
Remove admin from site admin list.
Create an outage.
During the outage open terminal and run php auth/outage/cli/finish.php --active.
There can be a scenario when default admin user is not a site admin. In this case finishing outage from CLI throws an exception:
Steps to replicate:
newadmin
.newadmin
as a new main admin.newadmin
.admin
from site admin list.php auth/outage/cli/finish.php --active
.