mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
MDL-83134 ai: context/capability checks for setting provider state.
This commit is contained in:
parent
2ea8adc589
commit
99be8d5676
5
ai/classes/external/set_action.php
vendored
5
ai/classes/external/set_action.php
vendored
@ -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');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user