Commit graph

100343 commits

Author SHA1 Message Date
Eloy Lafuente (stronk7)
20149b7cf7 Merge branch 'MDL-70565-311' of git://github.com/paulholden/moodle into MOODLE_311_STABLE 2021-03-16 22:49:05 +01:00
Eloy Lafuente (stronk7)
88847544c4 Merge branch 'MOODLE_311_MDL-71044_v3' of https://github.com/golenkovm/moodle into MOODLE_311_STABLE 2021-03-16 22:39:02 +01:00
Eloy Lafuente (stronk7)
50520ae4ad Merge branch 'MDL-67748-311-managewebservices' of git://github.com/mudrd8mz/moodle into MOODLE_311_STABLE 2021-03-16 19:29:04 +01:00
David Mudrák
2df0bcc7fd MDL-67748 admin: Add Behat tests for tokens filtering features
Credit goes to Andrew for Behat data generators for webservices.

Co-authored-by: Andrew Nicols <andrew@nicols.co.uk>
2021-03-16 10:47:01 +01:00
Sara Arjona
e37ef529db Merge branch 'MDL-44613-integration-311' of git://github.com/mihailges/moodle into MOODLE_311_STABLE 2021-03-16 08:26:57 +01:00
Eloy Lafuente (stronk7)
24c62a15c5 MDL-69474 accessibility: page->url can be not set, protect against that
Both in unit tests, but also in other areas (say blocks, for example)
it's possible that page->url has not been set yet.

So, let's change current code to always check if we have something
(page->url) to compare.

Note the use of has_set_url() is needed, because page->url is magic
method and it doesn't work as expected. Hate magics!
2021-03-16 12:56:40 +08:00
Mihail Geshoski
a7fb8415b8 MDL-44613 mod_assign: Fix behat failure in classic
The link to the calendar page is missing in the navigation block in
classic which causes a behat failure in the 'Set availibility dates
for an assignment' feature. The fix includes adding the calendar block
to the Course page which can be used to navigate to the calendar page.
2021-03-16 11:29:57 +08:00
Adrian Greeve
3972a25d6a Merge branch 'MDL-70780-311' of git://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2021-03-16 11:15:12 +08:00
David Mudrák
71e7806a18 MDL-67748 admin: Do not show missing capabilities for mobile app service
We used to display capabilities like "Manage any calendar entries",
"Delete evidence", "Manage competency frameworks", "View hidden courses"
and others as "Missing capabilities" for the mobile app service tokens.

This gave dangerous impression that the app will not work for students
without these capabilities granted. There are known cases of admins who
started to grant all these caps to the Authenticated user role because
they were afraid the app would not work for them.

The problem here is that the official mobile app service includes some
functions that have these capabilities declared as required. But they
are not really required to use the app. Either the app makes its own
clever checks of capabilities before calling the functions, or sometimes
the capabilities are not even correctly declared.

It is safer for everybody to display this information for custom
services only where the risk of the falsely missing caps is lower and
the information is more accurate.

Also, the help text has been improved so it does not suggest that these
capabilities must be always added. We do not know why the service has
them declared. In some cases, a service has capabilities declared just
because it makes use of them in the if-then fashion.

Additionally, the patch also displays the service short name because it
is actually needed to know.
2021-03-15 19:09:26 +01:00
David Mudrák
bbeba0756d MDL-67748 admin: Show user identity fields on the manage tokens page
On sites with many users, the fullname itself may not be unique
identifier of users. Display the user identity fields below the token
owner's name.
2021-03-15 19:09:26 +01:00
David Mudrák
4d49f07bbb MDL-67748 admin: Add filter to the WS tokens management page
The patch adds ability to filter the list of token by the token value,
the user and the service. Also the button to create a new token is made
more prominent and easier to spot.
2021-03-15 19:09:26 +01:00
David Mudrák
741ea63a70 MDL-67748 admin: Improve the display of tokens the user cannot see 2021-03-15 19:09:26 +01:00
David Mudrák
cb7d5a0939 MDL-67748 admin: Refactor tokens management as an external page
No need to have a dedicated admin_setting_managewebservicetokens admin
setting subclass, and yet do not use almost any of its features. So the
patch merges the list and the forms handling into a single external
page.

Similarly, it feels like overkill to have a renderer method for a
simple confirmation widget - especially given that the URLs were
hard-coded in it. So that one was dropped.
2021-03-15 19:09:26 +01:00
David Mudrák
fb91df08b3 MDL-67748 admin: Improve the display of missing capabilities
The patch improves the display of the missing capabilities on the Manage
tokens page and the Select authorised users page. The list of
capabilities is rendered in a collapsible area and does not occupy too
much space by default.

Additionally on the later page, the patch improves the display of the
list of existing authorised users so that it respects the configured
identity fields.
2021-03-15 19:09:26 +01:00
David Mudrák
2a189a9fc2 MDL-67748 admin: Improve get_missing_capabilities_by_users()
The previous implementation falsely reported all implicit capabilities
inherited from the authenticated user archetype. That caused a lot of
capabilities reported as missing, even if they were correctly granted.

This new implementation uses a different logic. Instead of seeking for
explicitly assigned capabilities, it searches for capabilities that are
not assigned to any of the user's role across the system.

Please refer to the inline documentation. This should be still used for
informative reports only, not for actual permissions evaluation. The
context has been ignored here, as well as all the overrides etc. This
patch just makes it a lesser evil.
2021-03-15 19:09:26 +01:00
David Mudrák
cd7c805d0a MDL-67748 admin: Simplify the webservice token form
We can now use the autocomplete element to select the user. No need to
for the legacy behaviour.
2021-03-15 19:09:26 +01:00
David Mudrák
29cfae4835 MDL-67748 admin: Respect the viewfullnames cap at manage tokens table 2021-03-15 19:09:26 +01:00
David Mudrák
cf4dbc4097 MDL-67748 user: Add new core_user/form_user_selector JS module
The module provides AJAX support for the autocomplete form element.
2021-03-15 19:09:26 +01:00
David Mudrák
b6be1e9822 MDL-67748 user: Add a new core_user_search_identity external function
The purpose of this external function is to provide data for
asynchronous user selectors and similar widgets. It allows to search
users matching the given query in their name or other available identity
fields.
2021-03-15 19:09:25 +01:00
Eloy Lafuente (stronk7)
df5a880db6 Merge branch 'MDL-69474-311' of https://github.com/NashTechOpenUniversity/moodle into MOODLE_311_STABLE 2021-03-15 16:54:51 +01:00
David Mudrák
4d68856c76 MDL-67748 user: Fix @link docs tag usage
Not related to this issue, just spotted while working on it.
2021-03-15 16:30:21 +01:00
David Mudrák
582745e5b9 MDL-67748 admin: Move the web service token form to its own file 2021-03-15 16:30:16 +01:00
David Mudrák
1ab5c29ead MDL-67748 admin: Move the web services under the server administration
I suppose the original reasoning was that the web services protocols are
pluggable and that plugins can provide external function. But those are
not good reasons to put the whole Web services section under plugins.
Web services are not a plugin type and they always felt very
counter-intuitive there.

From the server administrtaion perspective, web services are similar to
scheduled tasks and therefore, they should live in the same section.
2021-03-15 16:21:23 +01:00
Sara Arjona
3329494332 Merge branch 'MDL-44613-311-1' of git://github.com/mihailges/moodle into MOODLE_311_STABLE 2021-03-15 15:53:44 +01:00
Paul Holden
5543e99d6d MDL-70977 mod_forum: fix empty equality check updating post content.
Using the external method for updating posts, the check for empty
subject/message content wasn't correct (disallowed the string '0'),
in addition to being impossible to set a posts message format
property to FORMAT_MOODLE (integer 0).
2021-03-15 12:48:59 +00:00
Paul Holden
e2e4b15285 MDL-70924 course: ensure required fields present when getting courses. 2021-03-15 12:46:41 +00:00
Jun Pataleta
38607b4b93 Merge branch 'MDL-66667-cache-course-image-MOODLE_311_STABLE' of https://github.com/dmitriim/moodle into MOODLE_311_STABLE 2021-03-15 17:18:59 +08:00
Adrian Greeve
8dad051443 Merge branch 'MDL-70306-311' of git://github.com/peterRd/moodle into MOODLE_311_STABLE 2021-03-15 11:16:01 +08:00
Peter Dias
17779918f9 MDL-70306 auth: Update the thirdpartylib.xml 2021-03-15 11:10:12 +08:00
Peter Dias
e72dbd0752 MDL-70313 core: Update the thirdpartylib.xml 2021-03-15 10:28:03 +08:00
Peter Dias
c4b0667582 MDL-70313 core: Rebuilt module files 2021-03-15 10:28:03 +08:00
Peter Dias
63b9f338ed MDL-70313 core: Update codemirror to 5.59.4 2021-03-15 10:28:03 +08:00
Dmitrii Metelkin
88a150467f MDL-66667 course: add course image cache 2021-03-15 12:53:40 +11:00
Mihail Geshoski
978348d189 MDL-44613 mod_assign: Automate testing of the assignment availability 2021-03-15 08:26:17 +08:00
Mihail Geshoski
8a7fadc4ee MDL-44613 tool_behat: Update datetime format usages to strftime
Updates all existing datetime format usages to strftime in the
'time to timestamp' transformation in tool_behat behat tests.
2021-03-15 08:26:17 +08:00
Mihail Geshoski
70ae4664e6 MDL-44613 core_message: Update datetime format usages to strftime
Updates all existing datetime format usages to strftime in the
'time to timestamp' transformation in core_message behat tests.
2021-03-15 08:26:17 +08:00
Mihail Geshoski
3bc58c98d0 MDL-44613 behat: strftime format in time to timestamp transformation
Modifies the 'string time to timestamp' behat trasformation to use
userdate() instead of date(). The userdate() method is generally used
throught Moodle for constructing formatted date strings and this change
will provide more consistency and prevent any potential behat failures.
Therefore, if the date format is defined in the given trasformation, it
has to be strftime compatible. Example:
'I should see "##tomorrow noon##%A, %d %B %Y, %I:%M %p##"'
2021-03-15 08:26:17 +08:00
AMOS bot
c8a829ea3c Automatically generated installer lang files 2021-03-13 00:07:30 +00:00
Amaia Anabitarte
c2c3148664 MDL-70978 core_contentbank: Increasing contrast for unlisted content 2021-03-12 12:49:20 +01:00
Sara Arjona
c9110ffdce MDL-70689 oauth2: unit tests for new IMS OBv2.1
Apart from adding new unit tests for covering new IMS OBv2.1 issuer,
some extra tests have been added to test existing issuers and confirm
they are still working as expected after the changes.
2021-03-12 12:33:54 +01:00
Sara Arjona
a7229e4ad9 MDL-70689 oauth2: deprecate unused strings 2021-03-12 12:33:54 +01:00
Sara Arjona
9941e04857 MDL-70689 oauth2: self-register IMS OBv2.1 services
IMS OBv2.1 services have a registration endpoint to get client id
and secret.
This patch adds and implements the "register" method for the IMS
Open Badges Connect discovery system, to get the proper client id
and secret values.
2021-03-12 12:33:54 +01:00
Sara Arjona
84e51fb0fd MDL-70689 oauth2: add support to IMS OBv2.1 service
In order to make easier to create and maintain new OAuth2 services,
a couple of classes have been added:

- discovery\* contains methods related to the discovery system. Until
now, only OpenID Connect was supported by Moodle so all the code was
centralised in api.php.
With this patch, as IMS OBv2.1 has a different discovery system, a new
abstract class (base_definition) has been added to be called and let
every discovery system (OpenID Connect, IMS Badge Connect...)
implement their own methods.

- service\* . Instead of keep adding methods to the api, the service
namespace has been created to store all the standard issuer services.
An interface (issuer_interface) has been created and all the services
should implement it.
This patch creates the "IMS OBv2.1" and "Custom" services and moves
the methods for "Google" service because it uses the OpenID connect
discovery system.
2021-03-12 12:33:53 +01:00
Paul Holden
dbc7d37685 MDL-70565 user: filter course participants by country. 2021-03-12 09:50:02 +00:00
Eloy Lafuente (stronk7)
0357efb1fc MDL-71036 phpunit: Coding style changes, 99% whitespace only
I've gone over a few of the mofified files (those
which were showing warnings and errors to CiBoT. Some of them
have been fixed completely, while others only have fixed
for the lines belonging to this issue (lib/tests/moodlelib_test.php)
for example.
2021-03-11 23:07:31 +01:00
Eloy Lafuente (stronk7)
e2e333c9cd MDL-71036 phpunit: Add all the noticeable changes to upgrade notes 2021-03-11 23:07:31 +01:00
Eloy Lafuente (stronk7)
790237a77f MDL-71036 phpunit: xml config - switch coverage info to new includes
This applies the "whitelist" => "include" changes to all the core
phpunit_coverage_info occurrences, so core won't emit any deprecation
warning (see previous commit).

At the same time, modified a bunch of comments in coverage files
to be more readable/understandable.
2021-03-11 23:07:31 +01:00
Eloy Lafuente (stronk7)
a9c0c3d5a9 MDL-71036 phpunit: xml config - deprecate whitelist from coverage
Following the changes in the schema, from "whitelists" to "includes",
we are deprecating these two properties from phpunit_coverage_info:

- whitelistfolders => includelistfolders
- whitelistfiles   => includelistfiles

They will continue working over the deprecation period but the init/util
scripts will throw some warnings about them being deprecated for 3.11 and
the way to replace them.

Standard 2y deprecation applies with final removed to happen @ MDL-71067
2021-03-11 23:07:31 +01:00
Eloy Lafuente (stronk7)
d786046e52 MDL-71036 phpunit: xml config - change dist file to spread them to final
Basically switch to 2-space indenting and small tweaks to comments,
so both the main phpunit.xml file and also the individual components
ones, all them based in the dist one will be consistent.
2021-03-11 23:07:31 +01:00
Eloy Lafuente (stronk7)
50e3bb8546 MDL-71036 phpunit: xml config - change generation code to follow xsd
This performs all the changes needed in the util generator to
produce XML files compliant with the new schema (see previous
commit for description of changes).

- All the occurrences in code of filter => coverage.
- All the occurrences in code of whitelist => include.
- Apply all the changes to comply with the new schema.

- Remove processUncoveredFilesFromWhitelist attribute, useless (false
    is its default value, and now have another name).
- Move from 4-spaces indented XML to 2-spaces indented.
- Small linefeed tweaks to generate better-looking XML.
2021-03-11 23:07:31 +01:00