catalyst / moodle-auth_outage

Planned, graduated user and admin friendly moodle outages
https://moodle.org/plugins/auth_outage
17 stars 33 forks source link

Do not check event calendar capability when running cli/finish.php #170

Closed golenkovm closed 4 years ago

golenkovm commented 4 years ago

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: