From effa7d2ba185c32232aecd0a93468bf105140c52 Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Tue, 14 Nov 2017 11:26:08 +0800 Subject: [PATCH] MDL-60637 group: remove useless id number validation on web services --- group/externallib.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/group/externallib.php b/group/externallib.php index 53d2dfc61ac..4c04acd41fc 100644 --- a/group/externallib.php +++ b/group/externallib.php @@ -90,9 +90,6 @@ class core_group_external extends external_api { if ($DB->get_record('groups', array('courseid'=>$group->courseid, 'name'=>$group->name))) { throw new invalid_parameter_exception('Group with the same name already exists in the course'); } - if (!empty($group->idnumber) && $DB->count_records('groups', array('idnumber' => $group->idnumber))) { - throw new invalid_parameter_exception('Group with the same idnumber already exists'); - } // now security checks $context = context_course::instance($group->courseid, IGNORE_MISSING); @@ -627,9 +624,6 @@ class core_group_external extends external_api { if ($DB->count_records('groupings', array('courseid'=>$grouping->courseid, 'name'=>$grouping->name))) { throw new invalid_parameter_exception('Grouping with the same name already exists in the course'); } - if (!empty($grouping->idnumber) && $DB->count_records('groupings', array('idnumber' => $grouping->idnumber))) { - throw new invalid_parameter_exception('Grouping with the same idnumber already exists'); - } // Now security checks . $context = context_course::instance($grouping->courseid); @@ -731,11 +725,6 @@ class core_group_external extends external_api { $DB->count_records('groupings', array('courseid'=>$currentgrouping->courseid, 'name'=>$grouping->name))) { throw new invalid_parameter_exception('A different grouping with the same name already exists in the course'); } - // Check if the new modified grouping idnumber already exists. - if (!empty($grouping->idnumber) && $grouping->idnumber != $currentgrouping->idnumber && - $DB->count_records('groupings', array('idnumber' => $grouping->idnumber))) { - throw new invalid_parameter_exception('A different grouping with the same idnumber already exists'); - } $grouping->courseid = $currentgrouping->courseid; -- 2.43.0