Commit 20570e5d authored by Juan Leyva's avatar Juan Leyva
Browse files

MDL-65550 webservice: Return in get_site_info WS if user is admin

parent 7e16c70b
......@@ -206,6 +206,7 @@ class core_webservice_external extends external_api {
} else {
$siteinfo['usercalendartype'] = $USER->calendartype;
$siteinfo['userissiteadmin'] = is_siteadmin();
// Current theme.
$siteinfo['theme'] = clean_param($PAGE->theme->name, PARAM_THEME); // We always clean to avoid problem with old sites.
......@@ -275,6 +276,7 @@ class core_webservice_external extends external_api {
'siteid' => new external_value(PARAM_INT, 'Site course ID', VALUE_OPTIONAL),
'sitecalendartype' => new external_value(PARAM_PLUGIN, 'Calendar type set in the site.', VALUE_OPTIONAL),
'usercalendartype' => new external_value(PARAM_PLUGIN, 'Calendar typed used by the user.', VALUE_OPTIONAL),
'userissiteadmin' => new external_value(PARAM_BOOL, 'Whether the user is a site admin or not.', VALUE_OPTIONAL),
'theme' => new external_value(PARAM_THEME, 'Current theme for the user.', VALUE_OPTIONAL),
......@@ -130,6 +130,7 @@ class core_webservice_externallib_testcase extends externallib_advanced_testcase
} else {
$this->assertEquals($CFG->calendartype, $siteinfo['usercalendartype']);
$this->assertEquals($CFG->calendartype, $siteinfo['sitecalendartype']);
$this->assertEquals($user['theme'], $siteinfo['theme']);
......@@ -160,6 +161,7 @@ class core_webservice_externallib_testcase extends externallib_advanced_testcase
$this->assertEquals(0, $siteinfo['userquota']);
$this->assertEquals(USER_CAN_IGNORE_FILE_SIZE_LIMITS, $siteinfo['usermaxuploadfilesize']);
$this->assertEquals(true, $siteinfo['usercanmanageownfiles']);
$this->assertEquals($PAGE->theme->name, $siteinfo['theme']);
......@@ -9,6 +9,8 @@ This information is intended for authors of webservices, not people writing webs
is passed and the web service call does not require the user to be logged in we will attempt to use GET for the
request. This allows for things like proxy caching on URLs. The cache key must be changed if we do not want to
retrieve what has been cached and want to perform the request again.
* External function core_webservice_external::get_site_info() now returns a new field "userissiteadmin" indicating if
the current user is a site administrator.
=== 3.7 ===
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment