diff --git a/admin/tool/policy/classes/output/page_agreedocs.php b/admin/tool/policy/classes/output/page_agreedocs.php index 049b7db3c29..171a62a1716 100644 --- a/admin/tool/policy/classes/output/page_agreedocs.php +++ b/admin/tool/policy/classes/output/page_agreedocs.php @@ -401,6 +401,9 @@ class page_agreedocs implements renderable, templatable { $data->behalfuser = html_writer::link(\context_user::instance($this->behalfid)->get_url(), $userfullname); } + // User can cancel accepting policies only if it is a part of signup. + $data->cancancel = !isloggedin() || isguestuser(); + return $data; } diff --git a/admin/tool/policy/index.php b/admin/tool/policy/index.php index d53c0c558c3..38073ac9951 100644 --- a/admin/tool/policy/index.php +++ b/admin/tool/policy/index.php @@ -35,7 +35,8 @@ define('NO_SITEPOLICY_CHECK', true); // @codingStandardsIgnoreLine See the {@link page_agreedocs} for the access control checks. require(__DIR__.'/../../../config.php'); -$action = optional_param('action', null, PARAM_ALPHA); +$submit = optional_param('submit', null, PARAM_NOTAGS); +$cancel = optional_param('cancel', null, PARAM_NOTAGS); $agreedocs = optional_param_array('agreedoc', null, PARAM_INT); $behalfid = optional_param('userid', null, PARAM_INT); @@ -59,8 +60,10 @@ if (!empty($USER->id)) { if (!$haspermissionagreedocs) { $outputpage = new \tool_policy\output\page_nopermission($behalfid); +} else if ($cancel) { + redirect(new moodle_url('/')); } else { - $outputpage = new \tool_policy\output\page_agreedocs($agreedocs, $behalfid, $action); + $outputpage = new \tool_policy\output\page_agreedocs($agreedocs, $behalfid, $submit); } $output = $PAGE->get_renderer('tool_policy'); diff --git a/admin/tool/policy/templates/page_agreedocs.mustache b/admin/tool/policy/templates/page_agreedocs.mustache index 029b4335668..31674de4217 100644 --- a/admin/tool/policy/templates/page_agreedocs.mustache +++ b/admin/tool/policy/templates/page_agreedocs.mustache @@ -57,7 +57,6 @@