MDL-83134 ai: context/capability checks for setting provider state.

This commit is contained in:
Paul Holden
2024-09-16 16:08:27 +08:00
committed by Jun Pataleta
parent 2ea8adc589
commit 99be8d5676
+5
View File
@@ -16,6 +16,7 @@
namespace core_ai\external;
use core\context\system;
use core_ai\manager;
use core_external\external_api;
use core_external\external_function_parameters;
@@ -69,6 +70,10 @@ class set_action extends external_api {
'state' => $state,
]);
$context = system::instance();
self::validate_context($context);
require_capability('moodle/site:config', $context);
[$plugin, $action] = explode('-', $plugin);
$actionname = get_string("action_$action", 'core_ai');