Skip to content
GitLab
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
38c6a307
Commit
38c6a307
authored
Jan 13, 2016
by
Andrew Nicols
Browse files
Merge branch 'MDL-52586-master' of
git://github.com/jleyva/moodle
parents
64858d43
333e7770
Changes
2
Hide whitespace changes
Inline
Side-by-side
webservice/externallib.php
View file @
38c6a307
...
...
@@ -193,6 +193,9 @@ class core_webservice_external extends external_api {
// User max upload file size. -1 means the user can ignore the upload file size.
$siteinfo
[
'usermaxuploadfilesize'
]
=
get_user_max_upload_file_size
(
$context
,
$CFG
->
maxbytes
);
// User home page.
$siteinfo
[
'userhomepage'
]
=
get_home_page
();
return
$siteinfo
;
}
...
...
@@ -251,7 +254,10 @@ class core_webservice_external extends external_api {
'user quota (bytes). 0 means user can ignore the quota'
,
VALUE_OPTIONAL
),
'usermaxuploadfilesize'
=>
new
external_value
(
PARAM_INT
,
'user max upload file size (bytes). -1 means the user can ignore the upload file size'
,
VALUE_OPTIONAL
)
VALUE_OPTIONAL
),
'userhomepage'
=>
new
external_value
(
PARAM_INT
,
'the default home page for the user: 0 for the site home, 1 for dashboard'
,
VALUE_OPTIONAL
)
)
);
}
...
...
webservice/tests/externallib_test.php
View file @
38c6a307
...
...
@@ -124,6 +124,8 @@ class core_webservice_externallib_testcase extends externallib_advanced_testcase
$this
->
assertEquals
(
get_max_upload_file_size
(
$maxbytes
),
$siteinfo
[
'usermaxuploadfilesize'
]);
$this
->
assertEquals
(
true
,
$siteinfo
[
'usercanmanageownfiles'
]);
$this
->
assertEquals
(
HOMEPAGE_MY
,
$siteinfo
[
'userhomepage'
]);
// Now as admin.
$this
->
setAdminUser
();
...
...
@@ -138,6 +140,11 @@ class core_webservice_externallib_testcase extends externallib_advanced_testcase
$externaltoken
->
creatorid
=
$USER
->
id
;
$externaltoken
->
timecreated
=
time
();
$DB
->
insert_record
(
'external_tokens'
,
$externaltoken
);
// Set a home page by user preferences.
$CFG
->
defaulthomepage
=
HOMEPAGE_USER
;
set_user_preference
(
'user_home_page_preference'
,
HOMEPAGE_SITE
);
$siteinfo
=
core_webservice_external
::
get_site_info
();
// We need to execute the return values cleaning process to simulate the web service server.
...
...
@@ -147,6 +154,8 @@ class core_webservice_externallib_testcase extends externallib_advanced_testcase
$this
->
assertEquals
(
USER_CAN_IGNORE_FILE_SIZE_LIMITS
,
$siteinfo
[
'usermaxuploadfilesize'
]);
$this
->
assertEquals
(
true
,
$siteinfo
[
'usercanmanageownfiles'
]);
$this
->
assertEquals
(
HOMEPAGE_SITE
,
$siteinfo
[
'userhomepage'
]);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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