capabilities

This commit is contained in:
L_DA 2020-09-18 20:04:04 +00:00
parent 6f02d3c301
commit dfae16e4ff

View file

@ -149,7 +149,8 @@ class mod_timetable_external extends external_api {
//Capability checking
//OPTIONAL but in most web service it should present
if (!has_capability('mod/timetable:view'.$params['type'], $usercontext)) {
if (!(($params['type'] == 'class') && has_capability('mod/timetable:viewownclass', $usercontext) && ($params['name'] == str_replace('_','/',$USER->department))))
//if (!(($params['type'] == 'class') && has_capability('mod/timetable:viewownclass', $usercontext) && ($params['name'] == str_replace('_','/',$USER->department))))
if (!(($params['type'] == 'class') && ($params['name'] == str_replace('_','/',$USER->department))))
throw new \moodle_exception('cannotviewtimetable'.$params['type']);
}