MDL-63401 tool_dataprivacy: Move final cap check to endpoint

This commit is contained in:
Andrew Nicols 2018-10-09 08:21:25 +08:00
parent 65f77d319e
commit 7200ab20cd
3 changed files with 1 additions and 4 deletions

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);

View File

@ -1344,6 +1344,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);

View File

@ -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();