Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion local/o365/classes/form/cohortsync.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function definition(): void {

$deletemappingurl = new url(
'/local/o365/cohortsync.php',
['action' => 'delete', 'connectionid' => $mapping->id]
['action' => 'delete', 'connectionid' => $mapping->id, 'sesskey' => sesskey()]
);
$existingmappingstable->data[] = [
$groupname,
Expand Down
32 changes: 20 additions & 12 deletions local/o365/classes/page/acp.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ public function mode_healthcheck() {
public function mode_usermatchclear() {
global $DB;

require_sesskey();

$type = optional_param('type', null, PARAM_TEXT);
switch ($type) {
case 'success':
Expand Down Expand Up @@ -505,8 +507,8 @@ public function mode_usermatch() {
if ($matchqueuelength > 0) {
echo html_writer::start_tag('div', ['class' => 'local_o365_matchqueuetoolbar']);

$clearurl = new url('/local/o365/acp.php', ['mode' => 'usermatchclear']);
$clearurl = $clearurl->out();
$clearurl = new url('/local/o365/acp.php', ['mode' => 'usermatchclear', 'sesskey' => sesskey()]);
$clearurl = $clearurl->out(false);

// Clear successful button.
$checkicon = $OUTPUT->pix_icon('t/check', 'success', 'moodle');
Expand Down Expand Up @@ -1270,7 +1272,7 @@ public function mode_teamconnections() {
* Update Teams cache.
*/
public function mode_teamconnections_update_cache() {
confirm_sesskey();
require_sesskey();

$graphclient = \local_o365\feature\coursesync\utils::get_graphclient();
// Pass forceupdate=true so an explicit admin request is never silently skipped
Expand All @@ -1292,7 +1294,7 @@ public function mode_teamconnections_connect() {
$this->set_title(get_string('acp_teamconnection', 'local_o365'));

$courseid = required_param('course', PARAM_INT);
confirm_sesskey();
require_sesskey();

$redirecturl = new url('/local/o365/acp.php', ['mode' => 'teamconnections']);

Expand Down Expand Up @@ -1431,7 +1433,7 @@ public function mode_teamconnections_update() {
$this->set_title(get_string('acp_teamconnection', 'local_o365'));

$courseid = required_param('course', PARAM_INT);
confirm_sesskey();
require_sesskey();

$redirecturl = new url('/local/o365/acp.php', ['mode' => 'teamconnections']);

Expand Down Expand Up @@ -1572,6 +1574,8 @@ public function mode_teamconnections_update() {
public function mode_maintenance_recreatedeletedgroups() {
global $DB, $PAGE;

require_sesskey();

$this->set_title(get_string('acp_maintenance_recreatedeletedgroups', 'local_o365'));

$coursesenabled = \local_o365\feature\coursesync\utils::get_enabled_courses(true);
Expand Down Expand Up @@ -1664,6 +1668,8 @@ public function mode_maintenance_recreatedeletedgroups() {
public function mode_maintenance_resyncgroupusers() {
global $DB, $PAGE;

require_sesskey();

$this->set_title(get_string('acp_maintenance_resyncgroupusers', 'local_o365'));

$courseid = optional_param('courseid', 0, PARAM_INT);
Expand Down Expand Up @@ -1915,12 +1921,12 @@ public function mode_maintenance() {
echo html_writer::empty_tag('br');
echo html_writer::div(get_string('acp_maintenance_warning', 'local_o365'), 'alert alert-info');

$toolurl = new url($this->url, ['mode' => 'maintenance_resyncgroupusers']);
$toolurl = new url($this->url, ['mode' => 'maintenance_resyncgroupusers', 'sesskey' => sesskey()]);
$toolname = get_string('acp_maintenance_resyncgroupusers', 'local_o365');
echo html_writer::link($toolurl, $toolname, ['target' => '_blank']);
echo html_writer::div(get_string('acp_maintenance_resyncgroupusers_desc', 'local_o365'));

$toolurl = new url($this->url, ['mode' => 'maintenance_recreatedeletedgroups']);
$toolurl = new url($this->url, ['mode' => 'maintenance_recreatedeletedgroups', 'sesskey' => sesskey()]);
$toolname = get_string('acp_maintenance_recreatedeletedgroups', 'local_o365');
echo html_writer::empty_tag('br');
echo html_writer::link($toolurl, $toolname, ['target' => '_blank']);
Expand All @@ -1941,7 +1947,7 @@ public function mode_maintenance() {
echo html_writer::div(get_string('cfg_cleanupoidctokens_desc', 'auth_oidc'));

// Clear delta token.
$toolurl = new url($this->url, ['mode' => 'maintenance_cleandeltatoken']);
$toolurl = new url($this->url, ['mode' => 'maintenance_cleandeltatoken', 'sesskey' => sesskey()]);
$toolname = get_string('acp_maintenance_cleandeltatoken', 'local_o365');
echo html_writer::empty_tag('br');
echo html_writer::link($toolurl, $toolname);
Expand All @@ -1956,6 +1962,8 @@ public function mode_maintenance() {
public function mode_maintenance_cleandeltatoken() {
global $PAGE;

require_sesskey();

$this->set_title(get_string('acp_maintenance_cleandeltatoken', 'local_o365'));

$existingtaskuserysnclastdeltatokensetting = get_config('local_o365', 'task_usersync_lastdeltatoken');
Expand Down Expand Up @@ -2017,7 +2025,7 @@ public function mode_userconnections() {
public function mode_userconnections_resync(): bool {
global $DB;
$userid = required_param('userid', PARAM_INT);
confirm_sesskey();
require_sesskey();

if (utils::is_connected() !== true) {
mtrace('Microsoft 365 not configured');
Expand Down Expand Up @@ -2056,7 +2064,7 @@ public function mode_userconnections_manualmatch() {
global $DB, $PAGE;

$userid = required_param('userid', PARAM_INT);
confirm_sesskey();
require_sesskey();

// Perform prechecks.
$DB->get_record('user', ['id' => $userid], '*', MUST_EXIST);
Expand Down Expand Up @@ -2120,7 +2128,7 @@ public function mode_userconnections_unmatch() {
global $DB, $PAGE;

$userid = required_param('userid', PARAM_INT);
confirm_sesskey();
require_sesskey();
$user = $DB->get_record('user', ['id' => $userid], '*', MUST_EXIST);
$confirmed = optional_param('confirmed', 0, PARAM_INT);
if (!empty($confirmed)) {
Expand Down Expand Up @@ -2151,7 +2159,7 @@ public function mode_userconnections_disconnect() {

require_once($CFG->dirroot . '/auth/oidc/auth.php');
$userid = required_param('userid', PARAM_INT);
confirm_sesskey();
require_sesskey();
$user = $DB->get_record('user', ['id' => $userid], '*', MUST_EXIST);
$confirmed = optional_param('confirmed', 0, PARAM_INT);
if (!empty($confirmed)) {
Expand Down
1 change: 1 addition & 0 deletions local/o365/cohortsync.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@

$action = optional_param('action', '', PARAM_ALPHA);
if ($action == 'delete') {
require_sesskey();
$connectionid = required_param('connectionid', PARAM_INT);
if (!$connectionrecord = $DB->get_record('local_o365_objects', ['id' => $connectionid])) {
throw new moodle_exception('cohortsync_connectionnotfound', 'local_o365');
Expand Down