formatting, icon, language strings and capapilities
This commit is contained in:
parent
951a121dfa
commit
04b0a7ef72
8 changed files with 137 additions and 25 deletions
|
|
@ -53,8 +53,8 @@ class mod_timetable_external extends external_api {
|
|||
|
||||
//Capability checking
|
||||
//OPTIONAL but in most web service it should present
|
||||
if (!has_capability('moodle/user:viewdetails', $context)) {
|
||||
throw new moodle_exception('cannotviewprofile');
|
||||
if (!has_capability('mod/timetable:search', $context)) {
|
||||
throw new moodle_exception('cannotperformsearch');
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -146,11 +146,10 @@ class mod_timetable_external extends external_api {
|
|||
//$contextmodule = context_module::instance($cm->id);
|
||||
$usercontext = context_user::instance($USER->id);
|
||||
|
||||
|
||||
//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:view_own_class', $usercontext) && ($params['name'] == str_replace('_','/',$USER->department))))
|
||||
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))))
|
||||
throw new \moodle_exception('cannotviewtimetable'.$params['type']);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue