MDL-84479 tool_usertours: verify sesskey prior to tour duplication.

This commit is contained in:
Paul Holden
2025-04-08 16:16:22 +07:00
committed by Huong Nguyen
parent 15e392cec5
commit 8733010253
2 changed files with 4 additions and 4 deletions
+2 -3
View File
@@ -218,12 +218,11 @@ class helper {
* @return \moodle_url The URL.
*/
public static function get_duplicate_tour_link($tourid) {
$link = new \moodle_url('/admin/tool/usertours/configure.php', [
return new \moodle_url('/admin/tool/usertours/configure.php', [
'action' => manager::ACTION_DUPLICATETOUR,
'id' => $tourid,
'sesskey' => sesskey(),
]);
return $link;
}
/**
+2 -1
View File
@@ -512,8 +512,9 @@ class manager {
* @param int $tourid The ID of the tour to duplicate.
*/
protected function duplicate_tour($tourid) {
$tour = helper::get_tour($tourid);
require_sesskey();
$tour = helper::get_tour($tourid);
$export = $tour->to_record();
// Remove the id.
unset($export->id);