-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
3.4.2
-
MOODLE_34_STABLE
- Make sure $CFG->sitepolicyhandler is set to core
- Set something in $CFG->sitepolicyguest
- Add a calendar block on the frontpage (if not present)
- Logout, login as a guest
- View the frontpage
- You will see the AJAX exception:
Error code: sitepolicynotagreed
* line 2715 of /lib/moodlelib.php: moodle_exception thrown
* line 480 of /lib/externallib.php: call to require_login()
* line 981 of /calendar/externallib.php: call to external_api::validate_context()
* line 228 of /lib/externallib.php: call to core_calendar_external::get_calendar_monthly_view()
* line 59 of /lib/ajax/service.php: call to external_api::call_external_function()
This happens because guests are not required to agree to the policies when viewing frontpage, they are only required to agree to the policies when they try to view the course with guest access.
It is possible that the problem is actually inside external_api::validate_context() - it always calls require_login() and never require_course_login() , however, frontpage and frontpage activities do not call require_login(), some of them call require_course_login() instead.