Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
20570e5d
Commit
20570e5d
authored
Aug 15, 2019
by
Juan Leyva
Browse files
MDL-65550 webservice: Return in get_site_info WS if user is admin
parent
7e16c70b
Changes
3
Show whitespace changes
Inline
Side-by-side
webservice/externallib.php
View file @
20570e5d
...
...
@@ -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
),
)
);
...
...
webservice/tests/externallib_test.php
View file @
20570e5d
...
...
@@ -130,6 +130,7 @@ class core_webservice_externallib_testcase extends externallib_advanced_testcase
}
else
{
$this
->
assertEquals
(
$CFG
->
calendartype
,
$siteinfo
[
'usercalendartype'
]);
}
$this
->
assertFalse
(
$siteinfo
[
'userissiteadmin'
]);
$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
->
assertTrue
(
$siteinfo
[
'userissiteadmin'
]);
$this
->
assertEmpty
(
$USER
->
theme
);
$this
->
assertEquals
(
$PAGE
->
theme
->
name
,
$siteinfo
[
'theme'
]);
}
...
...
webservice/upgrade.txt
View file @
20570e5d
...
...
@@ -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 ===
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment