MDL-63401 tool_dataprivacy: Move final cap check to endpoint

This commit is contained in:
Andrew Nicols
2018-10-09 08:22:41 +08:00
parent ec259ef812
commit 5e77c5f24f
3 changed files with 1 additions and 4 deletions
-2
View File
@@ -1125,8 +1125,6 @@ class api {
public static function set_context_defaults($contextlevel, $categoryid, $purposeid, $activity = null, $override = false) {
global $DB;
self::check_can_manage_data_registry();
// Get the class name associated with this context level.
$classname = context_helper::get_class_for_level($contextlevel);
list($purposevar, $categoryvar) = data_registry::var_names_from_context($classname, $activity);
@@ -1299,6 +1299,7 @@ class external extends external_api {
// Validate context.
$context = context_system::instance();
self::validate_context($context);
api::check_can_manage_data_registry();
// Set the context defaults.
$result = api::set_context_defaults($contextlevel, $category, $purpose, $activity, $override);
@@ -1418,8 +1418,6 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
* @param bool $override Whether to override instances.
*/
public function test_set_context_defaults($contextlevel, $inheritcategory, $inheritpurpose, $foractivity, $override) {
$this->setAdminUser();
$this->resetAfterTest();
$generator = $this->getDataGenerator();