mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-49246 gradebook: add capability checks on key manager pages.
This commit is contained in:
parent
dba564c7db
commit
ead4d41e39
5 changed files with 37 additions and 3 deletions
|
@ -25,6 +25,7 @@
|
|||
|
||||
require_once('../../config.php');
|
||||
require_once('key_form.php');
|
||||
require_once($CFG->dirroot.'/grade/lib.php');
|
||||
|
||||
/// get url variables
|
||||
$courseid = optional_param('courseid', 0, PARAM_INT);
|
||||
|
@ -62,6 +63,12 @@ require_login($course);
|
|||
$context = context_course::instance($course->id);
|
||||
require_capability('moodle/grade:import', $context);
|
||||
|
||||
// Check if the user has at least one grade publishing capability.
|
||||
$plugins = grade_helper::get_plugins_import($course->id);
|
||||
if (!isset($plugins['keymanager'])) {
|
||||
print_error('nopermissions');
|
||||
}
|
||||
|
||||
// extra security check
|
||||
if (!empty($key->userid) and $USER->id != $key->userid) {
|
||||
print_error('notownerofkey');
|
||||
|
|
|
@ -39,6 +39,12 @@ $context = context_course::instance($id);
|
|||
|
||||
require_capability('moodle/grade:import', $context);
|
||||
|
||||
// Check if the user has at least one grade publishing capability.
|
||||
$plugins = grade_helper::get_plugins_import($course->id);
|
||||
if (!isset($plugins['keymanager'])) {
|
||||
print_error('nopermissions');
|
||||
}
|
||||
|
||||
print_grade_page_head($course->id, 'import', 'keymanager', get_string('keymanager', 'grades'));
|
||||
|
||||
$stredit = get_string('edit');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue