Compare commits

..

632 Commits

Author SHA1 Message Date
Jun Pataleta 823f673b73 Moodle release 4.2.11 2024-10-05 14:46:25 +08:00
AMOS bot 9c0ff75a5d Automatically generated installer lang files 2024-10-05 00:07:39 +00:00
Huong Nguyen 6d55f452d8 weekly release 4.2.10+ 2024-10-04 20:48:19 +07:00
Huong Nguyen 73d04ef74e Merge branch 'install_402_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_402_STABLE 2024-10-04 20:48:18 +07:00
AMOS bot 4f4d579ff7 Automatically generated installer lang files 2024-10-04 00:07:39 +00:00
Michael Hawkins 8fc56b46e1 MDL-83352 message: Update usercantbemessaged string 2024-10-03 17:48:14 +07:00
Shamim Rezaie 5e2a59a83e Merge branch 'MDL-83332-402' of https://github.com/meirzamoodle/moodle into MOODLE_402_STABLE 2024-10-03 02:25:01 +10:00
Paul Holden 1053b971c1 MDL-83180 reportbuilder: correct access check for viewing schedules. 2024-10-02 16:49:57 +08:00
meirzamoodle f949dda2bb MDL-83332 environment: Reverts the slashargument removal on MDL-62640
We are encountering Behat failures on MacOS and possibly Windows.

This reverts commit 3202109780.
2024-10-02 13:32:35 +07:00
Paul Holden d628e6bfbb MDL-83181 reportbuilder: ensure audience correctness before delete. 2024-09-30 15:33:35 +07:00
Paul Holden 07235465ca MDL-82386 block_rss_client: user access checks for feed edit/delete. 2024-09-27 11:53:16 +00:00
Huong Nguyen 7ad9944401 weekly release 4.2.10+ 2024-09-27 18:44:18 +07:00
Huong Nguyen 6d691e16b3 Merge branch 'install_402_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_402_STABLE 2024-09-27 18:44:16 +07:00
AMOS bot 0621cdcbd0 Automatically generated installer lang files 2024-09-27 00:07:39 +00:00
Huong Nguyen 84b0279b36 Merge branch 'MDL-62640-402' of https://github.com/meirzamoodle/moodle into MOODLE_402_STABLE 2024-09-26 11:07:49 +07:00
Sara Arjona 77c6dd8c55 weekly release 4.2.10+ 2024-09-24 16:52:17 +02:00
meirzamoodle a4aee520ab MDL-62640 environment: Remove the deprecated slash argument check 2024-09-23 13:07:16 +07:00
Sara Arjona d3bc590537 Merge branch 'MDL-81612_402' of https://github.com/timhunt/moodle into MOODLE_402_STABLE 2024-09-23 07:35:55 +02:00
Sara Arjona 397c5e357e weekly release 4.2.10+ 2024-09-20 16:36:21 +02:00
Sara Arjona 5584d36373 Merge branch 'install_402_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_402_STABLE 2024-09-20 16:36:15 +02:00
Tim Hunt 3194d058b2 MDL-81612 assign: test generation of extensions
Also, some other improvements.

* In Behat you can now use either idnumber of name to identify an
  assignment you are generating things for.
* create_submission generator methods now wants the cmid in $data['cmid']
  not the confusingly named 'assignid'. The old name is accepted, but
  generates a debugging warning. (That will fail the test, but in a way
  that explains how to fix it.)
2024-09-19 16:08:06 +01:00
AMOS bot 41f32d0a4e Automatically generated installer lang files 2024-09-19 00:09:26 +00:00
Huong Nguyen 28c5507861 Merge branch 'MDL-81278-402' of https://github.com/mickhawkins/moodle into MOODLE_402_STABLE 2024-09-18 16:09:25 +07:00
AMOS bot afc6b1903a Automatically generated installer lang files 2024-09-18 00:07:37 +00:00
Michael Hawkins 8301c80a95 MDL-81278 core: Update security.txt expiry 2024-09-16 14:50:55 +08:00
AMOS bot 5644e62971 Automatically generated installer lang files 2024-09-12 00:07:37 +00:00
AMOS bot 4d4cdc6bab Automatically generated installer lang files 2024-09-11 00:07:41 +00:00
Jun Pataleta 358aff25ce weekly release 4.2.10+ 2024-09-07 06:45:46 +08:00
Jun Pataleta d2b117e850 Merge branch 'MDL-63399-402' of https://github.com/lameze/moodle into MOODLE_402_STABLE 2024-09-06 12:29:29 +08:00
Simey Lameze ffbeec7615 MDL-63399 behat: update existing tests to use the better download steps
Co-authored-by: Tim Hunt <T.J.Hunt@open.ac.uk>
2024-09-06 12:17:14 +08:00
Simey Lameze 9a1a8521ac MDL-63399 behat: new steps to verify downloads
Co-authored-by: Tim Hunt <T.J.Hunt@open.ac.uk>
2024-09-06 12:12:21 +08:00
Huong Nguyen e6754cac35 Moodle release 4.2.10 2024-08-30 13:50:50 +07:00
Huong Nguyen a55e35eb64 weekly release 4.2.9+ 2024-08-29 18:10:07 +07:00
Paul Holden bb83d2d84f MDL-82365 mod_lesson: stricter equality checks of activity password. 2024-08-29 12:13:45 +08:00
Jun Pataleta 08e8db984c Merge branch 'MDL-82651-402' of https://github.com/lameze/moodle into MOODLE_402_STABLE 2024-08-29 11:59:44 +08:00
Jun Pataleta 944b61fbff Merge branch 'MDL-82802-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-08-29 11:40:07 +08:00
Huong Nguyen 908a25c60a Merge branch 'MDL-82898-402' of https://github.com/andelacruz/moodle into MOODLE_402_STABLE 2024-08-29 09:50:43 +07:00
Paul Holden b214133039 MDL-76962 auth_oauth2: users can only delete their own linked logins. 2024-08-29 10:33:17 +08:00
Angelia Dela Cruz d67b765f12 MDL-82898 enrol_self: Behat to test student enrolment using key 2024-08-28 11:57:49 +08:00
Simey Lameze 455faf3f3d MDL-82651 behat: remove unnecessary steps 2024-08-27 16:24:50 +08:00
Simey Lameze d7edf9a8df MDL-82651 behat: wait for button to exist before clicking 2024-08-27 16:24:50 +08:00
Marina Glancy dd3b81d627 MDL-82567 core: Add has_capability method
Co-authored-by: David Woloszyn <david.woloszyn@moodle.com>
Co-authored-by: Jun Pataleta <jun@moodle.com>
2024-08-24 06:33:16 +00:00
Shamim Rezaie d92728cacd Merge branch 'MDL-82006-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-08-24 16:21:39 +10:00
Sara Arjona 2cf275b49d weekly release 4.2.9+ 2024-08-23 16:04:10 +02:00
Sara Arjona d1e2ed624e Merge branch 'install_402_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_402_STABLE 2024-08-23 16:04:04 +02:00
Jake Dallimore 8fbab920e7 Merge branch 'MDL-82787-402' of https://github.com/andrewnicols/moodle into MOODLE_402_STABLE 2024-08-23 11:51:53 +08:00
Huong Nguyen 8cbd6496b0 Merge branch 'MDL-82841-402' of https://github.com/andelacruz/moodle into MOODLE_402_STABLE 2024-08-22 08:44:10 +07:00
Sara Arjona 6b27a037ba Merge branch 'MDL-82655-402' of https://github.com/andelacruz/moodle into MOODLE_402_STABLE 2024-08-21 15:54:36 +02:00
Angelia Dela Cruz 2991f6e78e MDL-82841 mod_workshop: Behat for submissions with set # of attachments 2024-08-21 19:23:28 +08:00
Angelia Dela Cruz e75588202a MDL-82655 mod_workshop: Behat test for manual and random allocation 2024-08-21 17:57:06 +08:00
Andrew Nicols 71f7003de8 MDL-82787 behat: Correct stop of webdriver on failure 2024-08-21 08:46:26 +08:00
AMOS bot d2b6e5728c Automatically generated installer lang files 2024-08-19 00:07:41 +00:00
Huong Nguyen 1984d0f465 weekly release 4.2.9+ 2024-08-16 08:40:02 +07:00
Paul Holden e506b18e86 MDL-82006 reportbuilder: move filter Behat scenarios inside component. 2024-08-15 13:17:32 +01:00
Paul Holden 6ca3a5fb55 MDL-82802 tool_xmldb: allow numeric characters in table names. 2024-08-15 12:00:48 +01:00
Jun Pataleta 4fede30d7f Merge branch 'MDL-82782-402' of https://github.com/andrewnicols/moodle into MOODLE_402_STABLE 2024-08-15 11:51:44 +08:00
Jun Pataleta a9e5f87376 Merge branch 'MDL-82798-402' of https://github.com/HuongNV13/moodle into MOODLE_402_STABLE 2024-08-15 11:13:29 +08:00
Huong Nguyen 86c09cebc8 Merge branch 'MDL-82758-402' of https://github.com/junpataleta/moodle into MOODLE_402_STABLE 2024-08-15 09:38:23 +07:00
Huong Nguyen 0a1bc3c0bc MDL-82798 qtype_ddmarker: Fix Behat failure 2024-08-15 09:17:32 +07:00
Jun Pataleta d9e42fb951 Merge branch 'MDL-82792-402' of https://github.com/sarjona/moodle into MOODLE_402_STABLE 2024-08-15 10:14:33 +08:00
Andrew Nicols 6357e519e8 MDL-82782 behat: Support runtime scaling of Behat windows 2024-08-14 21:48:52 +08:00
Sara Arjona 59f8be6d89 MDL-82792 h5p: Fix random behat failures
We've started seeing various failures in Firefox and Classic.
Increasing the default window size fixes them.
2024-08-14 12:18:39 +02:00
Sara Arjona 11041c8c08 Merge branch 'MDL-82682-402' of https://github.com/lameze/moodle into MOODLE_402_STABLE 2024-08-14 09:13:35 +02:00
Huong Nguyen c2ec489dec MDL-82682 behat: fix window size failures on Chrome 2024-08-14 10:19:59 +08:00
Simey Lameze df5d73f599 MDL-82682 behat: increase window size to avoid fails 2024-08-14 10:18:29 +08:00
Ilya Tregubov 62c1f37d40 Moodle release 4.2.9 2024-08-10 14:54:35 +08:00
Jun Pataleta f611f4fafc MDL-82758 gha: Remove reference to the master branch 2024-08-09 16:17:56 +08:00
Ilya Tregubov cfda0752ab weekly release 4.2.8+ 2024-08-09 09:34:33 +08:00
Huong Nguyen 9fb15b2357 MDL-82745 filter_tex: Improve PHPUnit test 2024-08-08 21:07:28 +08:00
Michael Hawkins d216f54daf MDL-82745 filter_tex: Improve filter deny list 2024-08-08 11:40:51 +07:00
Michael Hawkins ab19e3a35b MDL-82576 qtype_calculated: Improve formula regexes 2024-08-08 11:12:08 +07:00
Safat c08f1615ea MDL-82395 tool_xmldb: Table layout update 2024-08-08 10:01:34 +07:00
Jun Pataleta a92dfea792 Merge branch 'MDL-82560-402' of https://github.com/lameze/moodle into MOODLE_402_STABLE 2024-08-08 10:44:41 +08:00
Paul Holden 8f2b234393 MDL-79373 admin: ensure all current password configs are defined.
Ensure the admin preset export tool has an accurate record of each,
to be observed as sensitive settings when creating an export.
2024-08-08 09:22:55 +07:00
Angelia Dela Cruz 3e442e842a MDL-82560 mod_forum: Test that students can only start one discussion 2024-08-08 10:18:42 +08:00
Huong Nguyen 4fa7993ca5 Merge branch 'MDL-82669-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-08-08 08:59:12 +07:00
Jun Pataleta 483aa01191 Merge branch 'MDL-77784-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-08-08 09:55:21 +08:00
Jun Pataleta b45e5e9e64 Merge branch 'MOODLE_402_MDL-82518' of https://github.com/danielneis/moodle into MOODLE_402_STABLE 2024-08-07 17:11:54 +08:00
Paul Holden 2736b6e7fa MDL-81394 restore: format backup file metadata details safely. 2024-08-07 14:05:05 +08:00
Huong Nguyen f26739cfec MDL-81718 core_grades: Fix Behat failures 2024-08-07 10:53:21 +08:00
raortegar 3d336a1afa MDL-81718 core: Improve localstorage validation 2024-08-07 10:53:21 +08:00
Paul Holden 4a21f27def MDL-82558 h5p: escape template error/exception content. 2024-08-05 11:02:46 +08:00
Daniel Neis Araujo 8c36dadbe2 MDL-82518 core_user: Fix regression introduced by MDL-80271 2024-08-02 15:02:11 -03:00
Paul Holden 82d535640a MDL-82669 mod_assign: remove Atto reliance workaround for Behat.
See 8fe80e743c for context, and 802ff3e2e3 for additonal comments.
2024-08-02 10:33:51 +01:00
Paul Holden 7e5acc697b MDL-82669 editor: remove reliance on Atto editor in Behat scenarios. 2024-08-02 10:33:50 +01:00
Paul Holden 97866086d3 MDL-82392 blocks: consistent cleaning of block instance names. 2024-08-02 01:33:18 +00:00
Paul Holden 00b1e807ab MDL-82261 mod_feedback: ensure only non-respondents can be messaged. 2024-08-02 01:33:18 +00:00
Paul Holden 179fe73506 MDL-82390 badges: correct context check when deleting badges. 2024-08-02 01:33:18 +00:00
meirzamoodle a7834a73bf MDL-82136 curl: Send credentials to redirect URL if allowed
Curl has the option CURLOPT_UNRESTRICTED_AUTH. If true, curl will send
the credentials to a different host. If false, they will not be sent.

CURLOPT_UNRESTRICTED_AUTH can only work if the CURLOPT_FOLLOWLOCATION
option is true. The filelib forces the CURLOPT_FOLLOWLOCATION option
to be false, because all redirects are emulated at the PHP level. So,
in this case, the CURLOPT_UNRESTRICTED_AUTH option is only being used
in our logic and will not work as you might expect it to.

This patch works almost the same as CURLOPT_UNRESTRICTED_AUTH in ideal
conditions. It will check whether the host is different. If so, the
system will check what value CURLOPT_UNRESTRICTED_AUTH has. If it is
not specified, then by default, it will be false. If false, then
credentials will not be sent.
2024-08-02 01:33:18 +00:00
Paul Holden e97e13b7ec MDL-82262 mod_feedback: fix broken bulk message sesskey checks. 2024-08-02 01:33:18 +00:00
Paul Holden e41452ba37 MDL-64984 mod_glossary: capability check when restoring global type. 2024-08-02 01:33:18 +00:00
Ilya Tregubov 8d8ec98aea MDL-79541 core_grades: Add missing user info to search services.
Seems just fullname is not enough. So added all name fields.
2024-08-02 01:33:18 +00:00
Ilya Tregubov 27e94bad0a MDL-79541 core_grades: Fix singleview and user report selectors. 2024-08-02 01:33:18 +00:00
Ilya Tregubov a3342ca99f MDL-79541 core_grades: Hidden user fields check for search.
If some user profile fields are hidden on some grade reports
users without permission were able to see those.
2024-08-02 01:33:18 +00:00
Ilya Tregubov efce12bb63 weekly release 4.2.8+ 2024-08-02 09:30:59 +08:00
Ilya Tregubov c5783bb8d1 Merge branch 'install_402_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_402_STABLE 2024-08-02 09:30:56 +08:00
Paul Holden cbafc99366 MDL-77784 quiz_grading: editor agnostic Behat scenario steps. 2024-08-01 14:17:47 +01:00
Huong Nguyen a6c2b16be5 Merge branch 'MDL-82598-402' of https://github.com/lameze/moodle into MOODLE_402_STABLE 2024-08-01 10:27:23 +07:00
AMOS bot ce34532f39 Automatically generated installer lang files 2024-08-01 00:07:29 +00:00
Jun Pataleta 5c6365cde6 MDL-72876 theme_classic: Enclose welcome message in Bootstrap card 2024-07-31 17:15:55 +02:00
Sara Arjona 0ed9c4bc30 Merge branch 'MDL-82596-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-07-31 16:46:22 +02:00
Simey Lameze 09c29f3496 MDL-82598 behat: improve example submission test 2024-07-31 09:05:30 +08:00
AMOS bot aa2c8af443 Automatically generated installer lang files 2024-07-31 00:07:26 +00:00
Ilya Tregubov c4d0b41624 Merge branch 'MDL-80345-402' of https://github.com/MartinGauk/moodle into MOODLE_402_STABLE 2024-07-29 11:35:10 +08:00
Paul Holden 0c39608eaf MDL-82596 behat: switch manual private files upload to generator. 2024-07-28 19:29:39 +01:00
Paul Holden 32a85859bf MDL-82596 behat: tidy up existing usage of private files generator.
Filename is no longer required (since 83db25c330), given it never
did anything so can be removed. Requiring the "Private files" block
also isn't necessary since original switch to generator methods.
2024-07-28 19:15:12 +01:00
Jun Pataleta b98c8f7a5f weekly release 4.2.8+ 2024-07-26 13:35:52 +08:00
Jun Pataleta 6027dc0942 Merge branch 'install_402_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_402_STABLE 2024-07-26 13:35:49 +08:00
Jun Pataleta 5746cd1ba4 Merge branch 'MDL-82373-402' of https://github.com/andrewnicols/moodle into MOODLE_402_STABLE 2024-07-26 13:19:25 +08:00
Andrew Nicols abb970f87c MDL-82373 core_message: Make message drawer router behat-aware
The drawer router was modifying the DOM in a variety of ways and hiding
content, without any pendingJS checks. As a result, there were cases
where a part of the UI was not visible, but had been rendered and was in
the DOM.

This change wraps the router Go method in a pendingJS call that only
resolves when the router transition completes.

Additionally the lazy load manager had a similar issue.
2024-07-26 12:53:29 +08:00
Huong Nguyen 578f563ea6 Merge branch 'MDL-82527-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-07-25 10:49:39 +07:00
Jun Pataleta f8e8c6eff2 Merge branch 'MDL-82373-402' of https://github.com/andrewnicols/moodle into MOODLE_402_STABLE 2024-07-25 11:31:02 +08:00
Jun Pataleta 9e961824a3 Merge branch 'MDL-77706-402' of https://github.com/andrewnicols/moodle into MOODLE_402_STABLE 2024-07-25 11:02:24 +08:00
Huong Nguyen b6d37642e8 Merge branch 'MDL-82553-402' of https://github.com/junpataleta/moodle into MOODLE_402_STABLE 2024-07-25 09:18:01 +07:00
Huong Nguyen cbcd372a39 Merge branch 'MDL-82422-402' of https://github.com/andelacruz/moodle into MOODLE_402_STABLE 2024-07-25 08:37:16 +07:00
AMOS bot a700df849f Automatically generated installer lang files 2024-07-25 00:08:02 +00:00
Jun Pataleta ef214ba29a Merge branch 'MDL-81803-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-07-24 16:57:35 +08:00
Angelia Dela Cruz 06a7c2fb1c MDL-82422 mod_workshop: Behat for how strict assessment comparison is 2024-07-24 14:16:38 +08:00
Jun Pataleta ce1233b43c MDL-82553 behat: Run accessibility tests using WCAG 2.2 success criteria 2024-07-22 14:38:10 +08:00
AMOS bot 26737b5337 Automatically generated installer lang files 2024-07-21 00:07:36 +00:00
Ilya Tregubov 8233caad6d weekly release 4.2.8+ 2024-07-19 09:30:37 +08:00
Paul Holden 07b0a5740b MDL-82527 h5p: improve editor Behat scenarios for embedding content.
* Move the shared drag fixture out of the Atto plugin;
* Switch to using faster generators for populating private files;
* Clarify required fields for private files generator
2024-07-18 09:38:13 +01:00
Sara Arjona 9ba5a1a913 Merge branch 'MDL-82353-402' of https://github.com/andelacruz/moodle into MOODLE_402_STABLE 2024-07-17 17:08:26 +02:00
Andrew Nicols 45f64ecdef MDL-82373 contentbank: Pause in Behat before interacting with h5p
It seems that the loading of the h5p content upsets other interactions
with the page in Firefox as it loads. Unfortunately I haven't found a
reliable way to handle this with pendingJS yet.

This is the poor man's fix and we should find a better solution.
2024-07-17 13:47:14 +08:00
Andrew Nicols 6007ba3c53 MDL-82373 question: Make window larger in behat tests
I would suggest that this is a stop gap to solve some failing tests. We
really need to look at whether we can improve the usability of this
interface on smaller displays as a longer-term fix.
2024-07-17 13:47:14 +08:00
Andrew Nicols d11d6e1fd9 MDL-82373 behat: Wait for alerts before accepting/dismissing them 2024-07-17 13:46:09 +08:00
Andrew Nicols e2faf39070 MDL-82373 core: Make CollapsibleRegion more tolerant to behat 2024-07-17 13:46:09 +08:00
Andrew Nicols 7ce351e8b5 MDL-82373 tool_usertours: Ensure that behat waits for tours to show/hide 2024-07-17 13:46:07 +08:00
Andrew Nicols a8a5651b8f MDL-82373 behat: Stop killing the entire Behat run on driver error
If there's a driver error, for example from a step taking too long, then
this kills the entire Behat run and we have to start from scratch.

This change instead throws away the original connection and starts a new
one to try and continue the test.
2024-07-17 13:45:22 +08:00
Andrew Nicols 65b8f8c33d MDL-82373 behat: Stop calling ensure_node_is_visible before click
W3C WebDriver Element::Click, Element::Clear, and Element::SendKeys all
state that the WebDriver implementation (chromedriver, geckodriver,
edgedriver) should scroll the element into view if it is not already
visible.

It is wrong for us to check if the element is visible or not before
calling these as it may not be but will during the click/clear/type
event.
2024-07-17 13:41:24 +08:00
Andrew Nicols 97ff8d2f9f MDL-77706 atto_link: Work around Mozilla bug 1906559
This upstream bug prevents creation of an anchor with a hyperlink where
the content has a block-like display.

The workaround is to wrap the content in a span, set the display to
inline, call the `createLink` command on the span, move the content out
of the span, and then remove it.

This is only done for Firefox-based browsers.
2024-07-17 13:35:25 +08:00
Andrew Nicols d9e35bd123 MDL-82373 mod_lesson: Fix failing behat tests for Selenium 4
Recent versions of Chrome do not re-render the page but return previous
page state from cache. The page state had the Submit button disabled
before navigating away.

Refreshing the page addresses this.
2024-07-17 13:35:25 +08:00
Angelia Dela Cruz 5b76a6fd20 MDL-82353 gradingform: Behat to verify marking guide can be set to draft 2024-07-16 17:12:24 +08:00
Andrew Nicols e98f31c222 MDL-66903 core: Check PHPUNIT_TEST defined before using 2024-07-15 13:42:57 +07:00
Huong Nguyen 45e3520fe6 Merge branch 'MDL-66903-402' of https://github.com/andrewnicols/moodle into MOODLE_402_STABLE 2024-07-15 13:22:35 +07:00
Andrew Nicols aa12f3ab77 MDL-66903 core: Introduce \core_component::reset to replace hacks
Traditionally we have done this using reflection and it would be better
to do this in a 'proper' fashion in case we ever need to change how it
works.
2024-07-15 12:22:20 +08:00
Andrew Nicols 8603e870d7 MDL-66903 core: Add option to get core in list of components
Note: This change is backported from MDL-81063.
2024-07-15 12:22:20 +08:00
Andrew Nicols 5fdc5a3bda MDL-66903 core: Add helper to get component name from classname
Note: This change is backported from MDL-81063.
2024-07-15 12:22:19 +08:00
Andrew Nicols 2eb8d9af4c MDL-66903 testing: Helper to load fixture files 2024-07-15 12:22:17 +08:00
Andrew Nicols 90d53f7d90 MDL-66903 testing: Add support for a \tests\ namespace during tests
This commit:
- introduces a \tests\ sub-namespace for use in unit tests only
- the path to this the tests/classes directory of the owning parent
- files here are excluded from unit test runs

This is agreed per policy in MDL-80855.
2024-07-15 12:21:54 +08:00
Paul Holden a75906d75e MDL-81803 tool_dataprivacy: observe disabled expiration time.
A non-positive integer value should indicate "No time limit".
2024-07-12 11:05:13 +01:00
Huong Nguyen 0f3cc7d9f5 weekly release 4.2.8+ 2024-07-12 08:42:16 +07:00
Andrew Nicols e1d8bfd7d8 Merge branch 'MDL-82431-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-07-11 11:47:02 +08:00
Huong Nguyen 7933daf5cc Merge branch 'MDL-79717-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-07-11 09:35:50 +07:00
Huong Nguyen 767e84f401 Merge branch 'MDL-76654-402' of https://github.com/lameze/moodle into MOODLE_402_STABLE 2024-07-11 09:20:08 +07:00
Paul Holden 2c68ee6918 MDL-82431 phpunit: correct unit test filename and classname.
Standardise the same test cases, e.g. make final, covers notation,
static data providers, namespaces, etc.

Once the tests run, a couple of them failed. They required changes
to assertions to make them pass.
2024-07-10 19:06:21 +01:00
Paul Holden 7c72ec0373 MDL-79717 phpunit: ensure unique data provider keys in tests.
Duplicate data provider keys were overwriting and/or duplicating
one another, leading to some cases being skipped.

Other "duplicate array key" errors were picked up by `phpcs` in
this dragnet across all tests, which have also been fixed.
2024-07-10 14:08:57 +01:00
Huong Nguyen e59ce79f00 Merge branch 'MDL-82236-402' of https://github.com/andelacruz/moodle into MOODLE_402_STABLE 2024-07-10 09:04:46 +07:00
Angelia Dela Cruz 6ff2db90f9 MDL-82236 mod_data: Behat to display DB activity entry rating 2024-07-09 15:07:58 +08:00
Sara Arjona 3dd7c6f6f8 Merge branch 'MDL-81296-402' of https://github.com/andelacruz/moodle into MOODLE_402_STABLE 2024-07-09 08:50:48 +02:00
Angelia Dela Cruz 41ac252e70 MDL-81296 mod_data: Behat test for data activity readonly availability 2024-07-09 12:52:44 +08:00
Simey Lameze 41269b7115 MDL-76654 behat: fixes and improvements to self assessment test 2024-07-08 11:22:30 +08:00
Angelia Dela Cruz 5bf260d921 MDL-76654 behat: Coverage for workshop self-assessment 2024-07-08 11:22:30 +08:00
Andrew Nicols ee1ea6ffe6 MDL-66903 testing: Fix whitespace 2024-07-05 22:15:06 +08:00
Andrew Nicols f5a2991935 MDL-66903 testing: Reset CFG and component after test
This change moves the reset of global test state to the finally section
rather than doing it only if the test passes.

Previously if a test which modifies the `core_component` internals
failed, it would not reset the internal state and impact subsequent
tests.
2024-07-05 22:15:06 +08:00
Ilya Tregubov 34b34aed9c weekly release 4.2.8+ 2024-07-05 09:02:12 +08:00
Sara Arjona 423cbd2824 Merge branch 'MDL-80907-402' of https://github.com/HuongNV13/moodle into MOODLE_402_STABLE 2024-07-04 11:19:21 +02:00
Huong Nguyen d76c95f425 MDL-80907 behat: Fix incorrect column selectors 2024-07-04 15:17:12 +07:00
Huong Nguyen e3581a759a Merge branch 'MDL-80907-402' of https://github.com/marinaglancy/moodle into MOODLE_402_STABLE 2024-07-04 11:14:37 +07:00
Ilya Tregubov a344e93c28 Merge branch 'MDL-63670-402' of https://github.com/andrewnicols/moodle into MOODLE_402_STABLE 2024-07-04 10:58:26 +08:00
Sara Arjona 47197dded0 Merge branch 'MDL-82363-402' of https://github.com/HuongNV13/moodle into MOODLE_402_STABLE 2024-07-03 08:23:57 +02:00
Huong Nguyen f90b310189 MDL-82363 Calendar: Responsiveness improvement for calendar block
Hide the month name if the screen is too small
2024-07-03 11:02:54 +07:00
Sara Arjona 0a00ae5151 weekly release 4.2.8+ 2024-06-27 16:36:59 +02:00
Sara Arjona 574e7b39f4 Merge branch 'install_402_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_402_STABLE 2024-06-27 16:36:56 +02:00
Andrew Nicols 71427f127c MDL-63670 core_message: Tests should not use another testcase as base 2024-06-27 11:20:42 +08:00
Jun Pataleta 83b31ea2d6 Merge branch 'MDL-79809-402' of https://github.com/HuongNV13/moodle into MOODLE_402_STABLE 2024-06-27 11:01:10 +08:00
Huong Nguyen ab1982b600 MDL-79809 environment: Moodle 4.5 requirements 2024-06-24 09:37:32 +07:00
Huong Nguyen 9ea30b852d MDL-79809 environment: Add missing Moodle 4.4 requirements 2024-06-24 09:37:31 +07:00
Huong Nguyen feb5468de7 MDL-79809 environment: Add recommended custom check
Add support for custom environment checks to have a recommended
option in addition to required an optional.
2024-06-24 09:37:31 +07:00
AMOS bot 1ba4c16317 Automatically generated installer lang files 2024-06-22 00:14:03 +00:00
Martin Gauk 3835002cf1 MDL-80345 core_lock: deal with hash collisions in postgres_lock_factory 2024-06-20 17:33:04 +02:00
Sara Arjona 89855404de weekly release 4.2.8+ 2024-06-20 16:31:09 +02:00
Sara Arjona 44d7647837 Merge branch 'install_402_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_402_STABLE 2024-06-20 16:31:06 +02:00
AMOS bot ab9737d0ec Automatically generated installer lang files 2024-06-20 00:16:18 +00:00
Huong Nguyen 157135400d Merge branch 'MDL-81249-402' of https://github.com/andelacruz/moodle into MOODLE_402_STABLE 2024-06-19 09:19:07 +07:00
Angelia Dela Cruz e684f9a0eb MDL-81249 gradingform: Behat test that grades are retained 2024-06-18 19:03:58 +08:00
Angelia Dela Cruz 766fd1c555 MDL-81249 gradingform: Enhance Behat test for deleting marking guide 2024-06-18 17:46:54 +08:00
Huong Nguyen 5eba696644 Merge branch 'MDL-82148_402' of https://github.com/stronk7/moodle into MOODLE_402_STABLE 2024-06-18 16:28:16 +07:00
Eloy Lafuente (stronk7) dddcaba228 MDL-82148 phpunit: Remove all cases of multiple @coversDefaultClass
Only one by class is allowed (to be used as shortcut exclusively).
2024-06-14 16:05:36 +02:00
Ilya Tregubov c136d9798d weekly release 4.2.8+ 2024-06-14 08:57:13 +08:00
Huong Nguyen 9b4a0b4978 Merge branch 'MDL-81332-402' of https://github.com/andelacruz/moodle into MOODLE_402_STABLE 2024-06-12 13:16:25 +07:00
Angelia Dela Cruz 6958f54ef4 MDL-81332 core_course: Behat test for grade and activity reports display 2024-06-11 16:43:04 +08:00
Andrew Nicols 2d41ac46f4 Moodle release 4.2.8 2024-06-07 14:55:25 +08:00
Jun Pataleta afa68b9685 weekly release 4.2.7+ 2024-06-06 22:30:43 +08:00
Jun Pataleta f5c82455b8 NOBUG: Fixed file access permissions 2024-06-06 22:30:43 +08:00
Huong Nguyen 684a375b45 Merge branch 'MDL-81989-402' of https://github.com/lameze/moodle into MOODLE_402_STABLE 2024-06-06 22:21:42 +08:00
meirzamoodle dc84fcfab0 MDL-81890 assign: confirm_sesskey fixed in view_fix_rescaled_null_grades 2024-06-06 22:21:42 +08:00
meirzamoodle 093aedf798 MDL-81890 enrol_lti: Fix sesskey checks 2024-06-06 22:21:41 +08:00
meirzamoodle c1aacb3e28 MDL-81890 course: Fix sesskey checks 2024-06-06 22:21:41 +08:00
meirzamoodle c5b1604e81 MDL-81890 tool_moodlenet: Fix sesskey checks 2024-06-06 22:21:41 +08:00
Paul Holden 647b9dc064 MDL-81778 mod_bigbluebuttonbn: access checks when getting meeting URL. 2024-06-06 22:21:41 +08:00
Stevani Andolo 3048a162cb MDL-81412 calendar: Sanitise calendar event names 2024-06-06 22:21:24 +08:00
lameze b48193c056 MDL-81989 install: remove unnecessary closing div tags 2024-06-05 14:06:16 +08:00
Cameron Ball 3e38c84315 MDL-81774 curl: Strip auth headers when redirecting to different host 2024-06-05 02:03:17 +00:00
Huong Nguyen 5bf91592cd Merge branch 'MDL-81751-MOODLE_402_STABLE' of https://github.com/durzo/moodle into MOODLE_402_STABLE 2024-06-05 08:57:05 +07:00
Huong Nguyen b3b1d731ab Merge branch 'MDL-81955-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-06-04 10:34:18 +07:00
Juan Leyva 0caedaab7c MDL-80959 tool_mobile: Use different user keys for QR and auto login 2024-06-04 10:34:20 +08:00
Paul Holden 4461d3f6d6 MDL-81955 assignfeedback_editpdf: ensure ghostscript present in tests. 2024-05-31 07:14:10 +01:00
Ilya Tregubov 742bc470ab Merge branch 'MDL-77685-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-05-31 09:09:05 +08:00
Sara Arjona be10cd772b weekly release 4.2.7+ 2024-05-30 17:00:37 +02:00
Andrew Nicols c1aae7d366 MDL-81897 tool_mobile: Coding style fix 2024-05-28 11:44:33 +08:00
Andrew Nicols 19ea4c183d Merge branch 'MDL-81897-402' of https://github.com/jleyva/moodle into MOODLE_402_STABLE 2024-05-28 11:44:28 +08:00
Juan Leyva e5348292f2 MDL-81897 tool_mobile: Force partitioned cookies on inapp browser 2024-05-17 10:22:03 +02:00
Jordan Tomkinson 1d186d7f36 MDL-81751 ddl: new reserved keywords in Aurora MySQL database engine 2024-05-16 13:41:26 +01:00
Huong Nguyen 7ecbcb3c33 weekly release 4.2.7+ 2024-05-16 18:25:40 +07:00
Huong Nguyen a645dc7051 Merge branch 'install_402_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_402_STABLE 2024-05-16 18:25:38 +07:00
Huong Nguyen 00d0724b66 Merge branch 'MDL-79838-402' of https://github.com/andelacruz/moodle into MOODLE_402_STABLE 2024-05-16 09:22:32 +07:00
Angelia Dela Cruz 108fc684de MDL-79838 mod_h5pactivity: Behat for H5P activity grade settings control 2024-05-15 16:19:51 +08:00
Sara Arjona e1b3e14886 Merge branch 'MDL-81805-402' of https://github.com/lameze/moodle into MOODLE_402_STABLE 2024-05-14 17:05:52 +02:00
AMOS bot 80e8737375 Automatically generated installer lang files 2024-05-12 00:14:25 +00:00
Ilya Tregubov 95b5ca87eb weekly release 4.2.7+ 2024-05-10 09:09:45 +08:00
Jun Pataleta ab0792d943 Merge branch 'MDL-80972-402' of https://github.com/lameze/moodle into MOODLE_402_STABLE 2024-05-09 11:42:53 +08:00
info@eWallah.net 022a3d71fd MDL-80972 behat: Behat check_server_status can provide better info. 2024-05-09 11:07:53 +08:00
Huong Nguyen 9dbd03e51d Merge branch 'MDL-80453-402' of https://github.com/andelacruz/moodle into MOODLE_402_STABLE 2024-05-09 09:48:53 +07:00
Huong Nguyen 93b53c3bb1 Merge branch 'MDL-79702-402' of https://github.com/lameze/moodle into MOODLE_402_STABLE 2024-05-09 09:34:25 +07:00
Paul Holden c92cfe9aed MDL-77685 grade: remove Behat specific report rendering hacks.
These changes follow the same approach as that taken elsewhere in
the Gradebook in 3643f48e0f.
2024-05-08 12:29:56 +01:00
Mihail Geshoski 1fc3e502f0 MDL-77685 core_grades: Fix row_column_of_table_should_contain()
Backport from MDL-77632.
2024-05-08 12:29:56 +01:00
Angelia Dela Cruz b49bb7a6b5 MDL-80453 mod_glossary: Behat for different glossary format display 2024-05-08 17:36:07 +08:00
Marina Glancy 71b4125622 MDL-80907 various: fixes to incorrect column selectors in behat 2024-05-07 19:32:21 +01:00
Marina Glancy 70106f31f9 MDL-80907 behat: be more precise in selecting table rows 2024-05-07 19:32:15 +01:00
Simey Lameze cb49940156 MDL-81805 behat: remove unnecessary @javascript from tests 2024-05-07 09:10:41 +08:00
Simey Lameze 981272bc2c MDL-79702 behat: improvements and fixes to new tests
This commit adds the handling of tags as string separated by comma
to forum and glossary modules.
2024-05-06 20:02:47 +08:00
Angelia Dela Cruz 3cdf09eb8b MDL-79702 core_tag: Behat for activity tags deletion during course reset 2024-05-06 20:02:47 +08:00
Huong Nguyen 1f3550847b Merge branch 'MDL-80589-402' of https://github.com/lameze/moodle into MOODLE_402_STABLE 2024-05-06 09:37:41 +07:00
Ilya Tregubov 3fdb0f3580 weekly release 4.2.7+ 2024-05-03 08:22:46 +08:00
Ilya Tregubov 4ff803a9f3 Merge branch 'install_402_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_402_STABLE 2024-05-03 08:22:43 +08:00
AMOS bot 43386365b8 Automatically generated installer lang files 2024-05-03 00:10:40 +00:00
Simey Lameze b034a4a24a MDL-80589 behat: fixes and improvements to new tests 2024-05-02 13:34:07 +08:00
Angelia Dela Cruz f0ba09aabe MDL-80589 qtype_numerical: Behat to add, edit, preview numeric question 2024-05-02 13:34:07 +08:00
Huong Nguyen 13aa29cbae Merge branch 'MDL-79851-402' of https://github.com/lameze/moodle into MOODLE_402_STABLE 2024-05-01 16:12:03 +07:00
Angelia Dela Cruz d78d270031 MDL-79851 mod_h5pactivity: Behat for h5p activity access control 2024-05-01 14:26:31 +08:00
Sara Arjona c852ec91ab Merge branch 'MDL-81632-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-04-30 15:09:47 +02:00
Huong Nguyen 1f4489ed59 Merge branch 'MDL-79149-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-04-30 11:48:45 +07:00
Paul Holden 479da404db MDL-79149 report_participation: more resilient activity access test.
Use the "Forum" module rather than the "Book" module, because the latter
emits two events when a student views it - if these two events happened
either side of a single second, then the report  would count two distinct
views (when it was trying to assert only one).
2024-04-26 16:08:24 +01:00
Sara Arjona c862fc046c Merge branch 'MDL-77445-402' of https://github.com/andelacruz/moodle into MOODLE_402_STABLE 2024-04-26 10:40:45 +02:00
Sara Arjona 7b172f51b9 weekly release 4.2.7+ 2024-04-25 15:43:39 +02:00
Sara Arjona 2936dbdd3f Merge branch 'install_402_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_402_STABLE 2024-04-25 15:43:35 +02:00
Huong Nguyen 3d847c154a MDL-77998 Behat: Fix Behat failure 2024-04-25 10:31:58 +07:00
Paul Holden 1b0d03b87e MDL-81632 block_recentlyaccesseditems: deterministic item ordering.
Behat tests of this functionality could trigger the unlikely (in real
world usage) scenario where a user has an identical "timeaccess" value
for multiple course activities.

This led to random failures in said tests when the DB ordered items in
apparently random order, where the "timeaccess" value was equal.
2024-04-24 20:57:44 +01:00
Sara Arjona d5002415ce Merge branch 'MDL-77998-402' of https://github.com/andelacruz/moodle into MOODLE_402_STABLE 2024-04-24 14:48:11 +02:00
Angelia Dela Cruz 5eef98ee05 MDL-77998 Behat: Add behat coverage for preferences navigation 2024-04-24 19:47:51 +08:00
Angelia Dela Cruz f4220e56eb MDL-77445 Behat: Coverage for activity chooser navigation 2024-04-24 16:41:37 +08:00
Huong Nguyen dda25ae3c8 Merge branch 'MOODLE_402_MDL-81613' of https://github.com/danielneis/moodle into MOODLE_402_STABLE 2024-04-24 15:13:48 +07:00
Huong Nguyen e97accec36 Merge branch 'MDL-80107-402' of https://github.com/andelacruz/moodle into MOODLE_402_STABLE 2024-04-24 08:36:25 +07:00
Sara Arjona d5814b74be Merge branch 'MDL-81209-402' of https://github.com/andrewnicols/moodle into MOODLE_402_STABLE 2024-04-23 15:30:54 +02:00
Sara Arjona ea1bc14949 Merge branch 'MDL-81457-402' of https://github.com/andrewnicols/moodle into MOODLE_402_STABLE 2024-04-23 14:57:45 +02:00
Angelia Dela Cruz 0015c873ce MDL-80107 gradingform: Behat test for defining marking guide 2024-04-23 15:20:01 +08:00
Daniel Neis Araujo a95b757384 MDL-81613 report_log: fix user fullname export for log report 2024-04-22 14:36:42 -03:00
AMOS bot 2d1c685828 Automatically generated installer lang files 2024-04-22 00:10:28 +00:00
Jun Pataleta 6a1fcb3050 Moodle release 4.2.7 2024-04-20 15:57:37 +08:00
Huong Nguyen cff8e8dc6a weekly release 4.2.6+ 2024-04-19 17:05:36 +07:00
Jun Pataleta 4cea1c74ac Merge branch 'MDL-81584-402' of https://github.com/mihailges/moodle into MOODLE_402_STABLE 2024-04-19 11:03:42 +08:00
Mihail Geshoski 8f9d3179c3 MDL-81584 gradereport_grader: Pin the last row only when necessary
Fixes the current behavior where the last row in the grader report is
always 'pinned', ensuring it is pinned only when necessary.
2024-04-18 16:19:55 +08:00
Laurent David 5708639d32 MDL-81267 mod_data: Additional tests 2024-04-17 10:33:35 +02:00
Laurent David 63ba5e591d MDL-81267 mod_data: Clean field type before inclusion
* Filter out wrong field types when restoring or creating a field.
2024-04-17 10:33:35 +02:00
meirzamoodle 4b09e99595 MDL-81352 filter: Ensure equation safety prior to filtering 2024-04-17 13:34:52 +07:00
Stevani Andolo 9c4131f03d MDL-81354 core: Escape string of fullname 2024-04-17 03:23:20 +00:00
Paul Holden 915e3007a8 MDL-81062 mod_lesson: escape identity fields in overview report. 2024-04-17 03:23:20 +00:00
Paul Holden 1d0f426d97 MDL-80712 mod_workshop: stricter cleaning of sub-plugin values. 2024-04-17 03:23:20 +00:00
Paul Holden 2a54d31352 MDL-81058 admin: fix sesskey checks for admin preset actions. 2024-04-17 03:23:20 +00:00
Paul Holden 251b89743d MDL-81059 tool_analytics: fix sesskey checks for model actions. 2024-04-17 03:23:20 +00:00
Laurent David 6885687464 MDL-81284 mod_wiki: Add stricter cleaning of contentformat
* When restoring backup we clean the contentformat and defaultformat
to avoid issue with invalid value.
* Add tests for format and defaultformat so to check that we
 filter out invalid formats
* Remove private $basepath variable as it was used one and not always
initialised correctly.
2024-04-17 03:23:20 +00:00
Paul Holden 43bb50931d MDL-81135 mod_feedback: stricter cleaning of item type parameter. 2024-04-17 03:23:19 +00:00
Huong Nguyen 6c0e29e944 MDL-81247 calendar: Extra validation for webservices 2024-04-17 03:23:19 +00:00
Paul Holden 7a05e29d3d MDL-81247 calendar: freeze event type if "user" only allowed. 2024-04-17 03:23:19 +00:00
Leon Stringer 0f6571f1cd MDL-80585 report_log: sanitize descriptions
Strip any HTML tags from values in the "Description" column.
2024-04-17 03:23:19 +00:00
Huong Nguyen 97090433d6 Merge branch 'MDL-81552-402' of https://github.com/junpataleta/moodle into MOODLE_402_STABLE 2024-04-17 10:14:03 +07:00
Jun Pataleta 127da6652a MDL-81552 core: Assign proper webdav_client class variables 2024-04-16 13:06:54 +08:00
Sara Arjona 6ba9ca190c weekly release 4.2.6+ 2024-04-12 13:23:31 +02:00
Ilya Tregubov 394fa437a5 Merge branch 'MDL-80160-402' of https://github.com/HuongNV13/moodle into MOODLE_402_STABLE 2024-04-12 13:04:28 +08:00
Huong Nguyen a50d789801 MDL-80160 admin: Use html_writter to display the paragraph 2024-04-12 11:59:37 +07:00
Huong Nguyen a1eec364e5 Merge branch 'MDL-77015-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-04-12 11:46:25 +07:00
Huong Nguyen efa2c5881f Merge branch 'MDL-65381-402' of https://github.com/jleyva/moodle into MOODLE_402_STABLE 2024-04-12 11:11:55 +07:00
Andrew Nicols aa93afad1a Merge branch 'MDL-70829-402' of https://github.com/junpataleta/moodle into MOODLE_402_STABLE 2024-04-12 11:59:20 +08:00
Huong Nguyen 42f39c6ced MDL-79174 availability: Behat cleanups 2024-04-12 10:57:33 +07:00
Huong Nguyen b708b37a63 Merge branch 'MDL-79174_402_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_402_STABLE 2024-04-12 10:57:25 +07:00
Andrew Nicols 367f0e5b8c Merge branch 'MDL-81192_402_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_402_STABLE 2024-04-12 11:48:38 +08:00
Jun Pataleta 25e2df4fe0 MDL-70829 output: Remove the presentation role for html_writer::img()
* A presentation role is not necessary for the img tag.
  - If a non-empty alt text is provided, the presentation role will
  conflict with the alt text.
  - An empty alt text denotes a decorative image. The presence of a
  presentation role is redundant.
* Make sure that the alt text is set to an empty string. Otherwise,
  an img tag without an alt attribute will be produced which is an
  invalid markup.
2024-04-12 11:45:07 +08:00
Andrew Nicols 138ffb4719 Merge branch 'MDL-78902_402' of https://github.com/timhunt/moodle into MOODLE_402_STABLE 2024-04-12 11:19:10 +08:00
Jun Pataleta 8a525dcce6 MDL-70829 core: Set the icon of action icons as a decorative image
* When text is rendered for the action icon, set the icon as a
decorative image by setting empty alt and title attributes and adding
the aria-hidden attribute as well. Otherwise, assistive technologies
will read the action name twice.
2024-04-12 11:17:30 +08:00
Jun Pataleta fac456676f MDL-70829 block_recentlyaccesseditems: Move listitem role out of <a>
* Axe DevTools flags an error on the recently accessed items block that
the listitem role is not allowed for <a> tags. This is because the
"listitem" role will override the native semantic meaning of the course
links. So the solution is to move the course links within a <div> tag
with the listitem role instead.
2024-04-12 11:17:29 +08:00
Jun Pataleta 582b55df77 MDL-70829 tool_lp: Add empty alt text for decorative image
* The decorative image for the course modules in the user competency
summary modal is missing an empty alt text.
2024-04-12 11:17:29 +08:00
Jun Pataleta 87bacf1750 MDL-70829 theme_boost: Make context header icons decorative
The non-empty alt text for the icons of the context header buttons like
the "Message" and the "Add contact" buttons cause redundant information
to be read twice by screen readers when the buttons are rendered with
the icon and the button name. The icons need to be set as decorative by
setting an empty alt text for them.
* The presentation role is also unnecessary.
* The alt text is needed when the button gets rendered without the
button name text.
2024-04-12 11:17:29 +08:00
Jun Pataleta dd29c50196 MDL-70829 core_search: Mark up decorative image properly
* An empty alt text is enough for decorative images. There's no need
  to set a presentation role.
2024-04-12 11:17:06 +08:00
Jun Pataleta 7ad48d998d MDL-70829 enrol_manual: Mark up decorative image properly
* An empty alt text is enough for decorative images. There's no need
  to set a presentation role.
2024-04-12 11:17:06 +08:00
Jun Pataleta de9b088216 MDL-70829 mod_workshop: Mark up decorative images properly
* Decorative images should have an empty alt text and there's no need
to set a presentation role.
2024-04-12 11:17:06 +08:00
Jun Pataleta c726557be5 MDL-70829 mod_quiz: Mark up decorative images properly
* Decorative images should have an empty alt text and there's no need
to set a presentation role.
* Accessibility Behat tests added to cover the changes
2024-04-12 11:17:06 +08:00
Jun Pataleta 6a4307c700 MDL-70829 mod_data: Mark up decorative images properly
* Decorative images should have an empty alt text and there's no need
to set a presentation role.
* Accessibility Behat tests added to cover the changes
2024-04-12 11:17:05 +08:00
Jun Pataleta 80c7835f1b MDL-70829 course: Mark up decorative images properly
* Decorative images should have an empty alt text and there's no need
to set a presentation role.
* Accessibility Behat tests added to cover the changes:
  - block_starredcourses uses the core_course/no-courses template
  - core_completion tests changes in core_course/activity instance and
    core_course/editdefaultcompletion
2024-04-12 11:17:05 +08:00
Jun Pataleta a1c9eec784 MDL-70829 block_recentlyaccesseditems: Mark up decorative image properly
* The zero state image is purely decorative so there's no need to
set a non-empty alt text for it.
* The presentation role is also unnecessary for decorative image with
empty alt.
* Accessibility Behat tests added to cover changes
2024-04-12 11:17:05 +08:00
Jun Pataleta 1b2fb9e004 MDL-70829 block_myoverview: Mark up decorative image properly
* The zero state image is purely decorative so there's no need to
set a non-empty alt text for it.
* The presentation role is also unnecessary for decorative image with
empty alt.
* Accessibility Behat tests added to cover changes
2024-04-12 11:17:05 +08:00
Jun Pataleta b245e9e36e MDL-70829 tool_lp: Remove presentation role for decorative images
* Behat tests in report_competency added to test the user summary
display in the user competency summary modal.
2024-04-12 11:17:05 +08:00
Jun Pataleta 2c5df73e65 MDL-70829 core: Remove presentation role for decorative images
* An image with non-empty alt text should not have a presentation role.
* An empty alt attribute is sufficient for decorative images. No need to
add a presentation role for them.
* Additionally, if there is already text that is present for an image,
there's no need to add an alt text with the same text. Such images are
decorative and should just have an empty alt text.
2024-04-12 11:17:05 +08:00
Huong Nguyen 5b33d3ed96 Merge branch 'MDL-81320-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-04-12 10:12:05 +07:00
Huong Nguyen e92d302968 Merge branch 'MDL-81256-402' of https://github.com/marinaglancy/moodle into MOODLE_402_STABLE 2024-04-12 08:58:44 +07:00
Shamim Rezaie 49f208613a Merge branch 'MDL-81306-402' of https://github.com/andrewnicols/moodle into MOODLE_402_STABLE 2024-04-12 11:46:48 +10:00
Huong Nguyen 0cabf7439f Merge branch 'MDL-81316-402' of https://github.com/andrewnicols/moodle into MOODLE_402_STABLE 2024-04-12 08:37:26 +07:00
Huong Nguyen 2bf465589e Merge branch 'MDL-81420-402' of https://github.com/sarjona/moodle into MOODLE_402_STABLE 2024-04-12 08:34:28 +07:00
Ilya Tregubov 926a41ff15 Merge branch 'MDL-80160-402-siteadminsconfigphp' of https://github.com/mudrd8mz/moodle into MOODLE_402_STABLE 2024-04-12 08:47:38 +08:00
Shamim Rezaie b083d20b02 Merge branch 'MDL-81482_402' of https://github.com/AnupamaSarjoshi/moodle into MOODLE_402_STABLE 2024-04-12 09:31:40 +10:00
Tomo Tsuyuki ef609b5559 MDL-78902 quiz restore: fix restore of 3.x backups with random questions
... where the random questions come from the quiz module context.

Co-authored-by: Tim Hunt <T.J.Hunt@open.ac.uk>
2024-04-11 22:10:16 +01:00
Sara Arjona 3ab5b63463 Merge branch 'MDL-81472-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-04-11 17:35:54 +02:00
Andrew Nicols 88290b1968 Merge branch 'MDL-81114_402' of https://github.com/timhunt/moodle into MOODLE_402_STABLE 2024-04-11 23:26:21 +08:00
Sara Arjona a72c3d6f6b Merge branch 'MDL-80469-402' of https://github.com/marinaglancy/moodle into MOODLE_402_STABLE 2024-04-11 14:52:05 +02:00
Marina Glancy 92408cf43a MDL-80469 forms: add a hidden label to the button action group
This is a temporary solution to the accessibility problem
"Fieldsets without legend". We will no longer use a fieldset tag
if there is no legend after MDL-80431
2024-04-11 12:55:54 +01:00
Pedro Jordao cf4b8bec22 MDL-80195 forms: Keep dropdown menu open when tabbing into datepicker
When accessing a datepicker that is within a dropdown menu using the tab
key, the navigation sequence was changed since the datepicker code is
not rendered within the dropdown menu element, thus the dropdown was
closed as it was understood that we were not more inside it.
Furthermore, when exiting the datepicker by pressing tab, as the
dropdown was closed, the navigation jumped to the first element on the
page, which is the link to Skip to main content.

To resolve this, a validation was added that keeps the dropdown menu
open if the datepicker is open and accessed via the tab key.
2024-04-11 11:03:51 +02:00
Mark Johnson 578d35e81f MDL-81192 sessions: Prevent false positive session change errors
If $CFG->enable_read_only_sessions_debug was not enabled, debugging could be
enabled part-way through a request when restart_with_write_lock was
called. This meant that a diff between the initial and final session
would be made during write_close(), although the intial session state
was never captured. This generated false positives in the logs, and it
thought any variable set in the session was a change from the original
value.

This ensures that debugging is enabled before the debug flag is allowed
to change, preventing false positives.
2024-04-11 08:54:20 +01:00
Ilya Tregubov 073735a431 Merge branch 'MDL-80385-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-04-11 15:43:08 +08:00
Huong Nguyen 28f26a66c7 Merge branch 'MDL-81362-402' of https://github.com/ssj365/moodle into MOODLE_402_STABLE 2024-04-11 10:59:56 +07:00
Huong Nguyen 77f610789d Merge branch 'MDL-81327-402' of https://github.com/laurentdavid/moodle into MOODLE_402_STABLE 2024-04-11 10:19:31 +07:00
Ilya Tregubov 708caba53b Merge branch 'MDL-81491-402' of https://github.com/snake/moodle into MOODLE_402_STABLE 2024-04-11 09:51:35 +08:00
Sara Arjona ba4f0a0b3f Merge branch 'MDL-74977-402' of https://github.com/HuongNV13/moodle into MOODLE_402_STABLE 2024-04-10 15:51:05 +02:00
Huong Nguyen 50950c8001 MDL-74977 core_courseformat: add expanded section update actions
This also fix the Random "Course content preferences" Behat failure
2024-04-10 18:12:18 +07:00
Sara Arjona f56dfeb5d2 Merge branch 'MDL-81307-fix-402' of https://github.com/sarjona/moodle into MOODLE_402_STABLE 2024-04-10 12:53:01 +02:00
Sara Arjona 883ebde06f MDL-81307 theme: Fix behat failures with classic and sticky footer
Authored-by: Mikel Martín Corrales <mikel@moodle.com>
2024-04-10 12:36:43 +02:00
Jake Dallimore 5c94593816 MDL-81491 enrol_lti: fix incorrect login_hint parameter type validation
This was always bad, but since we only used it to verify the existence
of the param, and let library code take $_REQUEST for the real
validation, it was ok. Now, since we're redirecting to self during
necessary cookie checks added by MDL-80835, we lose the real value
originally stored in $_REQUEST. This patch just fixes the param type,
setting it to raw, which is what it should have used originally. The
raw value won't be cast from a string to an int as part of the
require_param call, so the value won't be lost any more.
2024-04-10 17:44:24 +08:00
Huong Nguyen 59103ae80e Merge branch 'MDL-81351-402-enfix' of https://github.com/mudrd8mz/moodle into MOODLE_402_STABLE 2024-04-10 13:55:52 +07:00
Anupama Sarjoshi 5a13faf0cf MDL-81482 Questions: Fix questionlib_test PHPUnit tests 2024-04-09 17:33:35 +01:00
Sara Arjona 41d94f98a0 Merge branch 'MDL-81307-402' of https://github.com/roland04/moodle into MOODLE_402_STABLE 2024-04-09 16:18:36 +02:00
Mikel Martín 7f18665575 MDL-81307 core_courseformat: Add bulk styles for small devices 2024-04-09 15:54:04 +02:00
Mikel Martín 112625d571 MDL-81307 core_behat: Backport closing drawer steps
Backport 'I close block drawer if open' and 'I keep block drawer closed' behat steps
added in MDL-75762 for 4.3 onwards.
2024-04-09 15:53:58 +02:00
Sara Arjona a6f26b66e2 Merge branch 'MDL-81451-402' of https://github.com/lucaboesch/moodle into MOODLE_402_STABLE 2024-04-09 15:31:15 +02:00
Paul Holden 13d6489f7c MDL-81472 mod_scorm: add missing library require to privacy class. 2024-04-09 11:38:14 +01:00
Sara Arjona e7d21fd9c0 weekly release 4.2.6+ 2024-04-09 12:07:28 +02:00
Laurent David ac5524575b MDL-81327 report_loglive: Apply the same fixes to loglive
* Additional fix: take into account selected group (filter)
2024-04-09 11:00:33 +02:00
Andrew Nicols b7ef78c4e6 MDL-81327 report_log: Make group filtering logstore agnostic
The original implementation of group filtering introduced in MDL-80565
assumed that the log table existed in Moodle's own database. This is not
the case of the database logstore, or any similar logstore implemetning
the database \core\log\sql_reader interface.

Furthermore this check was also applying the SQL when the user had the
`accessallgroups` capability, or when the course was not in SEPARATE
groups mode (no groupmode and/or visible groups).

Co-authored: Laurent David <laurent.david@moodle.com>
2024-04-09 11:00:33 +02:00
Laurent David d740bb09e3 MDL-81327 report_log: Fix col_fullusername
* Avoid calling get_user_fullname too many times and
deal with the case that $event->userid is empty
2024-04-09 11:00:33 +02:00
Andrew Nicols 7e5b98ea3e MDL-81327 core: Remove unnecessary table filter
The \Traversable interface does not define the `valid` method.
Furthermore, the `valid` method actually checks that there is a _next_
value, which requires the value already be fetched and waiting. This is
not the case for all Iterators. For example the CallbackFilterIterator
does not load the initial value until it is requested.

It is completely unnecessary to do this check anyway as an invalid
Iterator will just not return any values.
2024-04-09 11:00:33 +02:00
Jake Dallimore eb8ff555d5 Merge branch 'MDL-81060-402-fix' of https://github.com/meirzamoodle/moodle into MOODLE_402_STABLE 2024-04-09 10:13:54 +08:00
Luca Bösch fe4c9df572 MDL-81451 qtype_missingtype: adopt icon size to other. 2024-04-08 17:27:06 +02:00
Luca Bösch 9a1b4a4278 MDL-81451 qtype_gapfill: adopt icon size to other. 2024-04-08 17:27:06 +02:00
Sara Arjona e40e5dc513 Merge branch 'MDL-81298-MOODLE_402_STABLE' of https://github.com/vithushau/moodle into MOODLE_402_STABLE 2024-04-08 17:12:02 +02:00
Didier 'OdyX' Raboud 53e9136176 MDL-65381 grade_report: fix empty separate groups own grades access
On separate groups' courses, users without groups could not access
their own grade items.
2024-04-08 17:03:09 +02:00
Sara Arjona f67e87ec7a Merge branch 'MDL-78457-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-04-08 16:54:54 +02:00
Andrew Nicols 25e4619ae7 MDL-81209 core: Unit test should not care about plugin details 2024-04-08 20:54:25 +08:00
Huong Nguyen f7e5353863 Merge branch 'MDL-75037-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-04-08 16:07:03 +07:00
Marina Glancy 151edb5949 MDL-81256 lib: fix rounding of thumbnail image size 2024-04-08 10:02:07 +01:00
Sara Arjona c856ee60bf MDL-81420 enrol: Remove duplicated header in editing form 2024-04-08 10:49:35 +02:00
Jake Dallimore 37fc36554b Merge branch 'MDL-81405-402' of https://github.com/jleyva/moodle into MOODLE_402_STABLE 2024-04-08 15:35:33 +08:00
Ilya Tregubov 6e3e69b0cd Merge branch 'MDL-81409-402' of https://github.com/snake/moodle into MOODLE_402_STABLE 2024-04-08 12:45:40 +08:00
Huong Nguyen 32e3c9102f Merge branch 'MDL-80934-402' of https://github.com/laurentdavid/moodle into MOODLE_402_STABLE 2024-04-08 09:13:31 +07:00
Jake Dallimore 10df0d8122 MDL-81060 core: fix incorrect userquota usage in zip_packer
This change reverts much of MDL-74641, removing the erroneous userquota
checks from zip_packer. Now, during extraction, the zip_packer will exit
with an error status when it encounters a file which is larger than its
advertised size, and NOT when it determines the size of the extracted
files have exceeded the userquota (which only applies to private files
and which was used incorrectly here). It also reverts changes to the
draftfiles_ajax.php file, restoring the original (pre-MDL-74641) error
handling.
2024-04-08 09:11:37 +07:00
Huong Nguyen 17b57e06e0 Merge branch 'MDL-81402-MOODLE_402_STABLE' of https://github.com/sh-csg/moodle into MOODLE_402_STABLE 2024-04-08 09:03:35 +07:00
Andrew Nicols 341ec5ba81 MDL-81457 core: Do not mark tests as Incomplete when they are wrong
This check was marking a test as Incomplete if there was a bug in any
part of the test, rather than failing the test in such a way that the
test bug may be found.

https://docs.phpunit.de/en/9.6/incomplete-and-skipped-tests.html
2024-04-08 08:46:59 +08:00
Juan Leyva 5ede213279 MDL-81405 tool_mobile: Set Partitioned cookie when required 2024-04-06 12:29:52 +02:00
Juan Leyva e62918e4fd MDL-81405 session: New core cookie helper utility class 2024-04-06 12:29:51 +02:00
Paul Holden 83197cee22 MDL-81320 datafield_checkbox: account for empty field content. 2024-04-05 15:16:45 +01:00
Sara Arjona c0038b965e weekly release 4.2.6+ 2024-04-05 13:22:37 +02:00
Stefan Hanauska e179c272e3 MDL-81402 course: Add sectionnum to cm export 2024-04-04 13:51:29 +02:00
Laurent David a8ff93575d MDL-80934 core_courseformat: Expand section when selected
* Sections in the course content must be expanded when an item
from this section is selected in the course index
2024-04-04 10:41:42 +02:00
Andrew Nicols 7611878d8d MDL-81316 core: Encode anchor fragments properly to RFC 3986 2024-04-04 16:04:37 +08:00
Ilya Tregubov 899dc30959 Merge branch 'MDL-78370-402' of https://github.com/junpataleta/moodle into MOODLE_402_STABLE 2024-04-04 14:19:37 +08:00
Andrew Nicols 13efde9b95 NOBUG: mod_h5pactivity - Version bump after rewrite 2024-04-04 10:36:34 +08:00
Sara Arjona 481715aff9 Merge branch 'MDL-80765-402' of https://github.com/laurentdavid/moodle into MOODLE_402_STABLE 2024-04-03 17:19:03 +02:00
Huong Nguyen a398bbadc5 MDL-81393 atto: Disable mediaplugin filter for Behat test 2024-04-04 00:24:38 +11:00
Paul Holden 666cf9927d MDL-75037 core: update Moodlenet repository search URLs. 2024-04-03 13:00:45 +01:00
Jake Dallimore fa504af178 MDL-81409 enrol_lti: fixes to dynamic registration to support Blackboard
The following fixes resolve issues when used with Blackboard Learn:
- Set registration request Content-Type header to application/json
- Make registration_token optional, per the spec:
https://www.imsglobal.org/node/200666#step-1-registration-initiation-request
- Conditionally create the deployment since it's optional in
lti-tool-configuration:
https://www.imsglobal.org/node/200666#lti-configuration-0
- Remove empty custom_parameters property, since that's optional too:
https://www.imsglobal.org/node/200666#lti-configuration-0
- Remove overly-strict validation on registration_token. This was
validating the param as a JWT, but since the spec has stabilised, this
is not always the case. It's a Bearer token that's opaque to the tool
(i.e. it's just passed back unmodified), so while it could be validated
against RFC6750, it's simplest to just remove the validation entirely.
- change targetOrigin of the postMessage to '*' as per the spec:
https://www.imsglobal.org/node/200666#step-4-registration-completed-and-activation
2024-04-03 16:23:34 +08:00
Shamim Rezaie 366e8bd8c1 Merge branch 'MDL-81393-402' of https://github.com/HuongNV13/moodle into MOODLE_402_STABLE 2024-04-03 16:39:21 +11:00
Andrew Nicols 1bc2cc0bca Merge branch 'MDL-80818-402' of https://github.com/aanabit/moodle into MOODLE_402_STABLE 2024-04-03 13:06:25 +08:00
Huong Nguyen 02379cc237 Merge branch 'MDL-77779-402' of https://github.com/ilyatregubov/moodle into MOODLE_402_STABLE 2024-04-03 09:12:43 +07:00
Huong Nguyen 7a1cd8700a Merge branch 'MDL-81300-402' of https://github.com/roland04/moodle into MOODLE_402_STABLE 2024-04-03 09:07:05 +07:00
Huong Nguyen c0e8e44bf6 Merge branch 'MDL-77838-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-04-03 08:52:43 +07:00
Sara Arjona 6a008f13b5 weekly release 4.2.6+ 2024-04-02 14:46:46 +02:00
Paul Holden 1cce6e50c9 MDL-78457 course: remove participants navigation if cannot access. 2024-04-02 10:03:53 +01:00
Paul Holden f2c3a62385 MDL-77015 mod_data: consistent escaping of template field names.
* When creating default templates, avoid escaping the field names
  contained within [[ ]] brackets;
* When managing field, ensure the field names are escaped.
2024-04-02 10:02:14 +01:00
Mikel Martín 7fe5a9c323 MDL-81300 theme_boost: Fix dnd overlay in course sections
Drag and drop overlay in course page was being overlapped by divider
buttons and quick edit links.
That happens because both elements have their own z-index context.
Add z-index to the drag and drop overlay elenment to fix this issue.
2024-04-02 10:44:32 +02:00
Andrew Nicols f6e27c5dfa Merge branch 'MDL-79712-402' of https://github.com/snake/moodle into MOODLE_402_STABLE 2024-04-02 11:56:54 +08:00
Jake Dallimore ea15eb265b MDL-79712 auth_lti: ensure MoodleSession uses SameSite=None Secure
The MoodleSession cookie is already set this way when using Chrome, but
not for Firefox. This is a decision made in \core\session\manager. When
Firefox eventually defaults to SameSite=Lax when the SameSite attribute
is omitted from the Set-Cookie headers, the MoodleSession cookie won't
be sent. This change ensures the cookies used during LTI launches will
continue to work if/when this happens, and despite any changes which may
be made to core's sessionlib in future.
2024-04-02 11:42:11 +08:00
Laurent David 0a2120ab19 MDL-80765 mod_data: Trim values on field update
* When creating a field we usually trim values, so we should
do the same on field update
2024-04-02 05:41:45 +02:00
Huong Nguyen 443efa8df3 MDL-81393 media_videojs: Switch to use Ogv.Js tech for Chrome 2024-04-02 10:27:18 +07:00
David Mudrák 187d53de0a MDL-81351 lang: Use the fixed strings in the tests, too 2024-03-28 11:25:20 +01:00
Helen Foster fce7f84cca MDL-81351 lang: Import fixed English strings (en_fix) 2024-03-28 11:19:40 +01:00
Andrew Nicols 4a35061172 MDL-81306 core: Do not use xsendfile for request dirs 2024-03-28 09:30:07 +08:00
Andrew Nicols e72422e42c MDL-81306 core: Remove docs on use of xsendfile with request dirs
This reverts the change made in MDL-80648 and adds a note to not do it.
2024-03-28 09:29:27 +08:00
Ilya Tregubov 7197b66d58 Merge branch 'mdl80598-402' of https://github.com/matthewhilton/moodle into MOODLE_402_STABLE 2024-03-28 09:06:34 +08:00
Amaia Anabitarte b459df584c MDL-80818 QuickForm: Freeze all elements with the same name
There are some radio buttons in activity Completion Conditions settings
that must be frozen altogether, because all of them have the same name.
2024-03-27 16:28:53 +01:00
Vithusha Uthayakumar b838c9142c MDL-81298 external: fix typo error in failing testcase 2024-03-27 16:41:02 +11:00
Ilya Tregubov eee7268bd7 Merge branch 'MDL-80036-402' of https://github.com/mickhawkins/moodle into MOODLE_402_STABLE 2024-03-27 11:08:30 +08:00
Shamiso.Jaravaza bf9d201af9 MDL-81362 mod_bigbluebuttonbn: Fix content type 2024-03-26 20:14:28 -06:00
Sara Arjona fa4a79d6d7 weekly release 4.2.6+ 2024-03-26 12:31:16 +01:00
Jun Pataleta adf53426bf Merge branch 'MDL-81266_402' of https://github.com/stronk7/moodle into MOODLE_402_STABLE 2024-03-26 10:33:50 +08:00
Matthew Hilton 41d73d71b0 MDL-80598 bigbluebutton: Gracefully handle invalid customdata 2024-03-26 10:09:06 +10:00
Sara Arjona f4ba69224f Merge branch 'MDL-81246-402' of https://github.com/HuongNV13/moodle into MOODLE_402_STABLE 2024-03-25 17:01:51 +01:00
Sara Arjona 64325bc560 Merge branch 'MDL-80088-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-03-25 16:20:36 +01:00
Andrew Nicols c10d1a30da Merge branch 'MDL-80827-402' of https://github.com/stevandoMoodle/moodle into MOODLE_402_STABLE 2024-03-25 11:44:40 +08:00
Huong Nguyen 8406fd5cc2 Merge branch 'MDL-79829-402' of https://github.com/laurentdavid/moodle into MOODLE_402_STABLE 2024-03-25 09:22:58 +07:00
Huong Nguyen ff76a52fd1 Merge branch 'MDL-81074-402' of https://github.com/andrewnicols/moodle into MOODLE_402_STABLE 2024-03-25 09:16:05 +07:00
Andrew Nicols 054d15a42f MDL-81074 core: Simplify strftime tests 2024-03-25 09:51:25 +08:00
Luca Bösch bd4c8e3a70 MDL-81074 core: align core_date::strftime results for numeric and string 2024-03-25 09:51:25 +08:00
Andrew Nicols d265739f7d MDL-81074 core: Add assertTimeStringMatches PHPUnit Assertion
Also raised as https://github.com/sebastianbergmann/phpunit/issues/5757
2024-03-25 09:51:25 +08:00
Eloy Lafuente (stronk7) 4fcf69eb18 MDL-81266 composer: Bump behat/behat to 3.14 and other deps
Only applied to 402_STABLE and up, all them requiring PHP 8.0
as a minimum. And generated following the instructions in the
dev docs.
2024-03-23 13:37:42 +01:00
Paul Holden f512681b3b MDL-77838 repository: preserve empty dirs in download if selected. 2024-03-22 16:23:08 +00:00
Sara Arjona 23b110b28b weekly release 4.2.6+ 2024-03-22 14:03:01 +01:00
Jun Pataleta 14f699d4d9 Merge branch 'MDL-81313-402' of https://github.com/snake/moodle into MOODLE_402_STABLE 2024-03-22 11:47:41 +08:00
Sara Arjona f6240d0346 Merge branch 'MDL-80488-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-03-21 17:30:55 +01:00
Sara Arjona fdf6f2b5b4 Merge branch 'MDL-79913-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-03-21 17:18:25 +01:00
Sara Arjona 3f5ca666b5 Merge branch 'MDL-81112-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-03-21 17:11:41 +01:00
Sara Arjona 7dc2cc4074 Merge branch 'MDL-69688_402' of https://github.com/stronk7/moodle into MOODLE_402_STABLE 2024-03-21 15:29:58 +01:00
Huong Nguyen 4f1db606cd Merge branch 'MDL-81289-402' of https://github.com/ferranrecio/moodle into MOODLE_402_STABLE 2024-03-21 15:12:31 +07:00
Huong Nguyen f7c5f34883 Merge branch 'MDL-80835-402' of https://github.com/snake/moodle into MOODLE_402_STABLE 2024-03-21 14:54:02 +07:00
Jake Dallimore 8da80a17b2 MDL-80835 auth_lti: fix bad cast breaking samesite LTI usage 2024-03-21 15:39:06 +08:00
Jake Dallimore 2dc10f656b MDL-80835 enrol_lti: add partitioning support for OIDC state cookie
Adds the property that is required by Chrome to opt-in to its 3rd party
cookie partitioning solution, CHIPS. This specific change ensures the
'state' cookie, used in the OIDC handshake, has partitioning support.
This cookie can be partitioned unconditionally, since it's a cookie
controlled by the library and one we don't expect to be set without
partitioning elsewhere.
2024-03-21 15:39:06 +08:00
Jake Dallimore d225ecddbf MDL-80835 auth_lti: add partitioning to post-auth MoodleSession cookie
Adds the property that is required by Chrome to opt-in to its 3rd party
cookie partitioning solution, CHIPS. This specific change to auth_lti is
to ensure the MoodleSession Set-Cookie header resulting from
complete_user_login() calls (in auth.php) have this property set.
2024-03-21 15:39:06 +08:00
Jake Dallimore e58ca2edf4 MDL-80835 enrol_lti: add cookies required notice to auth login endpoint
This will be displayed if the cookie checks fail, which currently occurs
in Safari only.
2024-03-21 15:39:06 +08:00
Jake Dallimore 036c4e3a9c MDL-80835 enrol_lti: add partitioning support to MoodleSession cookie
Adds the property that is required by Chrome to opt-in to its 3rd party
cookie partitioning solution, CHIPS. This specific change deals with the
cookie that is set when the user is not yet auth'd with the site and is
necessary to facilitate OIDC nonce retrieval and validation.
2024-03-21 15:39:06 +08:00
Jake Dallimore c3597e30ae MDL-80835 auth_lti: add cookie helper facilitating CHIPS opt-in
To opt a cookie in to Chrome's 3rd party cookie partitioning solution,
CHIPS, the property 'Partitioned;' needs to be set. This adds a helper
class supporting this, for a given cookie(s).

Note also, PHP's native
cookie APIs (setcookie, etc) don't support this cookie property yet -
(https://github.com/php/php-src/issues/12646).

Since this class is intended to allow existing Set-Cookie headers to be
modified before being sent (e.g. allowing clients to set a property on a
cookie set elsewhere in code), it deals with the headers directly anyway
but it means that new cookies must also use this helper to opt-in,
instead of relying on setcookie(). E.g. where the intent is to add
partitioning support to a new cookie, that cookie must first be set
(setcookie) and then it may opt-in to partitioning via this helper;
partitioning support cannot be achieved directly through setcookie and
friends yet.
2024-03-21 15:39:05 +08:00
Eloy Lafuente (stronk7) 06f12a2027 MDL-69688 phpunit: Improve test_context_not_used
This adds a few changes to the old test_context_not_used test:

- Move it to become an advanced_test, because its mission
  is to verify that the assertEventContextNotUsed() assertion
  works as expected.
- For consistency, also move the fixtures to own phpunit fixtures.
- Add proper coverage tags, to verify that the assertion is being
  covered.
- Add a data provider to provide all the current cases and ease
  any future case that may be needed in the future. One by one
  because previously there was code never executed with the
  warning expectation causing the test to stop.
- Run them in isolation, while this is not strictly required, it's
  including external fixtures and, we'll need that isolation soon
  (for changes coming when moving the test to PHPUnit 9.6 in MDL-81266).
2024-03-21 08:30:01 +01:00
Jake Dallimore 4262ddd629 MDL-81313 core: Revert "Merge branch 'MDL-80338-402'
This reverts commit 714906f0b6, reversing
changes made to 9070c5dfcc.
2024-03-21 11:29:46 +08:00
Paul Holden 31ff0d1e3a MDL-80488 mod_lesson: avoid overflowing length of page titles. 2024-03-20 23:51:24 +00:00
Paul Holden 793487edcf MDL-81112 gradereport_grader: show user country value correctly. 2024-03-20 23:50:03 +00:00
Jun Pataleta 929cd807d6 Merge branch 'MDL-79007-402' of https://github.com/junpataleta/moodle into MOODLE_402_STABLE 2024-03-20 15:39:38 +08:00
Mark Johnson be192b5b27 MDL-79007 calendar: Make screen readers read the new month name 2024-03-20 15:13:38 +08:00
Mark Johnson 419930f35d MDL-79007 calendar: Make screen readers read out calendar day popovers 2024-03-20 15:11:50 +08:00
Mark Johnson c7104868f3 MDL-79007 calendar: Expose block month link names to screen readers 2024-03-20 15:03:19 +08:00
Ilya Tregubov 4aea02a526 weekly release 4.2.6+ 2024-03-20 08:54:15 +08:00
Ilya Tregubov e14310ea26 Merge branch 'install_402_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_402_STABLE 2024-03-20 08:54:12 +08:00
ferranrecio 6b11cd340c MDL-81289 core_courseformat: fix get_format_string params 2024-03-19 17:34:26 +01:00
Paul Holden e4621f3ba5 Merge branch 'MDL-78438-402' of https://github.com/ilyatregubov/moodle into MOODLE_402_STABLE 2024-03-19 10:45:35 +00:00
Ilya Tregubov 76298ee081 MDL-78438 gradereport_grader: Fix Behat test
Seems Oracle is too slow on pressing buttons :))
2024-03-19 17:45:38 +08:00
Michael Hawkins 17da4aa635 MDL-80036 core: Update security.txt expiry 2024-03-19 15:31:19 +08:00
Huong Nguyen 7e28d5386f Merge branch 'MDL-81156-402' of https://github.com/lameze/moodle into MOODLE_402_STABLE 2024-03-19 10:56:01 +07:00
Andrew Nicols 801b64899f Merge branch 'MDL-77255-402' of https://github.com/HuongNV13/moodle into MOODLE_402_STABLE 2024-03-19 11:40:03 +08:00
Huong Nguyen b4963516fe MDL-77255 block_tag_flickr: Update to match with the new API
Flickr dropped php_serial format, we need to change to JSON format
2024-03-19 10:14:52 +07:00
Ilya Tregubov 511371a6d4 Merge branch 'MDL-80240-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-03-19 10:28:35 +08:00
Ilya Tregubov cfdd746569 Merge branch 'MDL-80919-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-03-19 10:14:46 +08:00
Ilya Tregubov acc40ef803 Merge branch 'MDL-78438-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-03-19 09:47:34 +08:00
Ilya Tregubov 9f11b1fe13 Merge branch 'MDL-80793-402' of https://github.com/OxyOCE/moodle into MOODLE_402_STABLE 2024-03-19 09:12:59 +08:00
AMOS bot ce2d73bf6a Automatically generated installer lang files 2024-03-19 00:08:48 +00:00
Sara Arjona fe65233fd1 Merge branch 'MDL-72923-M402' of https://github.com/michael-milette/moodle into MOODLE_402_STABLE 2024-03-18 16:57:07 +01:00
Sara Arjona b6d6d75095 Merge branch 'MDL-81254-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-03-18 16:08:22 +01:00
Laurent David 5dd9626ff7 MDL-79829 theme: Fix Course index draggable cursor
* Make the cursor consistent for drag and drop operation
to be the same in the course content and the course index
2024-03-18 07:39:12 +01:00
Laurent David 313c6d80a0 MDL-79829 core: Reactive drag and drop cursor
* When dragging and dropping an item, the cursor should be
set to "move" and not copy.
2024-03-18 07:39:11 +01:00
Jun Pataleta 1300ddb017 Merge branch 'MDL-80279-402' of https://github.com/pedrojordao/moodle into MOODLE_402_STABLE 2024-03-18 11:22:32 +08:00
Paul Holden b34c1981b9 MDL-79913 grade: respect messaging config for user heading buttons. 2024-03-15 17:00:33 +00:00
Paul Holden 9f769b0fa1 MDL-81254 grade: ensure we always close the graded user iterator.
This ensures that the recordsets contained within are also closed
when we're done with them.
2024-03-15 16:26:36 +00:00
Huong Nguyen 87a08ab157 weekly release 4.2.6+ 2024-03-15 21:48:22 +07:00
Huong Nguyen cf7e8e194d Merge branch 'install_402_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_402_STABLE 2024-03-15 21:48:21 +07:00
Pedro Jordao bce2299e75 MDL-80279 core: Set new attributes for user profile initials
When the user does not have a profile photo and initials are displayed,
there is no alt text for the initials which causes accessibility
issues, so with this change I added the user's full name to the title
and aria-label attributes and I set a role='img' when the element span
is rendered.
2024-03-15 07:43:35 -03:00
Jake Dallimore 6fd3a9054f Merge branch 'MDL-80167-402-int' of https://github.com/HuongNV13/moodle into MOODLE_402_STABLE 2024-03-15 12:54:59 +08:00
Huong Nguyen bb057e53af MDL-81246 dml: Check the statement resource before freeing it 2024-03-15 11:19:50 +07:00
Huong Nguyen 7b9d71254b MDL-80167 core: Skip Oracle for Oracle environment in unit tests 2024-03-15 08:46:39 +07:00
Ilya Tregubov d0dc438919 Merge branch 'MDL-81190-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-03-15 08:42:40 +08:00
Sara Arjona a6a84d6fe8 Merge branch 'MDL-80167-402' of https://github.com/HuongNV13/moodle into MOODLE_402_STABLE 2024-03-14 11:55:04 +01:00
Sara Arjona 1b445aa197 Merge branch 'MDL-80479-402' of https://github.com/lameze/moodle into MOODLE_402_STABLE 2024-03-14 11:48:04 +01:00
Huong Nguyen 315ad4b289 MDL-80167 admin: Add environment check for Oracle database 2024-03-14 17:42:45 +07:00
Simey Lameze cf5e25259d MDL-80479 behat: improve new test for quiz timer 2024-03-14 10:21:24 +08:00
Angelia Dela Cruz 2f2c6408c9 MDL-80479 mod_quiz: Behat to set quiz opening and closing time 2024-03-14 10:21:24 +08:00
Ilya Tregubov 7dbecdbacc MDL-77779 competency: Fix course restore from older backups.
overridegrade might be not set if Moodle < 4.1
2024-03-14 09:30:01 +08:00
Simey Lameze 4ffded4880 MDL-81156 behat: coverage for force course language 2024-03-14 09:04:42 +08:00
AMOS bot 0c20c4f178 Merge branch 'MOODLE_402_STABLE' into install_402_STABLE 2024-03-14 00:13:13 +00:00
Dale Davies f1dc10573f MDL-80385 core: Check lock state before attempting to acquire a lock
This is a cherry-pick of the same change from MDL-76865, which was
accidentally reverted in MDL-79428.
2024-03-13 13:56:44 +00:00
Sara Arjona 2f826c7407 Merge branch 'MDL-80865-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-03-13 12:19:06 +01:00
Ilya Tregubov 1a42f253de Merge branch 'MDL-80565-402' of https://github.com/laurentdavid/moodle into MOODLE_402_STABLE 2024-03-13 11:23:07 +08:00
AMOS bot d2295281fa Automatically generated installer lang files 2024-03-13 00:11:06 +00:00
Ilya Tregubov 0ff19ca287 weekly release 4.2.6+ 2024-03-13 08:09:53 +08:00
Tim Hunt b200b26636 MDL-81039 qtype_multichoice: better way to control feedback display 2024-03-12 12:02:21 +01:00
Tim Hunt 7f7ed47336 MDL-81039 question: Improve some comments in question_display_options 2024-03-12 12:02:11 +01:00
Huong Nguyen ae51dc65aa Merge branch 'MDL-76805-402' of https://github.com/lameze/moodle into MOODLE_402_STABLE 2024-03-12 10:32:43 +07:00
Shamiso.Jaravaza c59fdffc2f MDL-76805 mod_bigbluebuttonbn: Fix up behat tests 2024-03-12 11:07:59 +08:00
Ilya Tregubov d1cd5d9c59 Merge branch 'MDL-81035-402' of https://github.com/HuongNV13/moodle into MOODLE_402_STABLE 2024-03-12 10:41:01 +08:00
Ilya Tregubov 27b9963490 Merge branch 'MDL-81127-402' of https://github.com/izendegi/moodle into MOODLE_402_STABLE 2024-03-12 10:27:35 +08:00
Ilya Tregubov b2e39b8a7f Merge branch 'MDL-81191-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-03-12 10:16:07 +08:00
Paul Holden b2bc5b2849 MDL-81191 course: define batch stealth feedback language string. 2024-03-11 17:28:31 +00:00
Paul Holden 3de04dae67 MDL-81190 mod_assign: correct context argument to format string. 2024-03-11 16:58:08 +00:00
Sara Arjona 2233454466 Merge branch 'MDL-79027-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-03-11 17:27:01 +01:00
Laurent David db79dde840 MDL-80565 report_loglive: Do not show logs from other groups
* Prevent users from seeing logs from other groups if
groupmode is in SEPARATEGROUP
2024-03-11 14:30:50 +01:00
Laurent David 63f1f94a76 MDL-80565 report_log: Prevent user from seeing other logs
* When no groups are selected we forcefully prevent
users from seeing users' logs from other groups
2024-03-11 14:30:50 +01:00
Laurent David 58d0ae35cb MDL-80565 report_log: Fix report log selector
* When using the report log and we select a group, the group
list should show the right list of users
2024-03-11 14:30:49 +01:00
Laurent David 85b832ff8a MDL-80565 report: Revert MDL-41465 changes
* Partial revert of changes made in MDL-41465,
while keeping the API changes made in enrol/lib.
2024-03-11 14:30:49 +01:00
Huong Nguyen 55473ab11d MDL-81035 core: Fix redirect with sub-path 2024-03-11 15:56:21 +07:00
Tim Hunt 7884d5b779 MDL-81114 question: fix selection of random questions with draft status
We need to pick the latest 'ready' version of each question
(not questions where the latest version is ready).
2024-03-08 19:31:43 +00:00
Iñigo Zendegi 6ed0b36d3b MDL-81127 filter: Support filters on course completion message 2024-03-08 14:09:26 +01:00
Sara Arjona 58e84e19b2 weekly release 4.2.6+ 2024-03-08 11:11:57 +01:00
Ilya Tregubov 1132a4e7ba Merge branch 'MDL-78547-402-phpunit' of https://github.com/HuongNV13/moodle into MOODLE_402_STABLE 2024-03-08 13:44:14 +08:00
Huong Nguyen e68c43c3df MDL-78547 quiz: Remove unnecessary call to clear_regrade_date_cache()
This method is designed to clear the values but these values are never set anywhere
It's safe to remove it out of the test now
2024-03-08 12:42:09 +07:00
Ilya Tregubov 3f86d722c0 Merge branch 'MDL-80550-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-03-08 11:06:07 +08:00
Huong Nguyen c3a943edd2 Merge branch 'MDL-78547_402' of https://github.com/timhunt/moodle into MOODLE_402_STABLE 2024-03-08 08:52:24 +07:00
Ilya Tregubov 8f7b882630 Merge branch 'MDL-80943-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-03-08 09:22:58 +08:00
Tim Hunt 91609a45cf MDL-78547 quiz: in a preview, if a question has been edited, update it
As part of implementing this, there is a new more efficient method
get_version_information_for_questions_in_attempt to see if any
questions in a quiz need to be updated. The regrade code was updated
to take advantage of this.

Co-authored-by: Khoa Nguyen Dang <khoanguyend7@nashtechglobal.com>
2024-03-07 16:14:28 +00:00
Tim Hunt 66ff5a87d0 MDL-78547 questions: a way to replace a attempt in a usage
... without keeping the old attempt

Co-authored-by: Khoa Nguyen Dang <khoanguyend7@nashtechglobal.com>
2024-03-07 16:14:28 +00:00
Sara Arjona fc6ad45ecd MDL-69656 backup: Remove illegal whitespaces 2024-03-07 12:05:37 +01:00
Paul Holden b014a4b944 MDL-80943 reportbuilder: select-type customfields should be text.
The column type determines the available aggregation options present
for the column. Custom fields of type "select" should be considered as
text fields for this purpose, because their stored value represents
the index to their available options, rather than having any distinct
meaning of it's own for display.
2024-03-07 09:48:02 +00:00
Huong Nguyen 722cb7e4f8 Merge branch 'MDL-79990-402' of https://github.com/lameze/moodle into MOODLE_402_STABLE 2024-03-07 10:04:58 +07:00
Simey Lameze 2d7b5f4859 MDL-79990 behat: custom step to verify assign grading data
This commit also optimise the new behat test.
2024-03-07 09:44:28 +08:00
Angelia Dela Cruz 07aaf4b0a4 MDL-79990 gradingform: Behat test for marking guide information display 2024-03-07 09:44:28 +08:00
Andrew Nicols d54cef26cd Merge branch 'MDL-69656-MOODLE_402_STABLE' of https://github.com/sh-csg/moodle into MOODLE_402_STABLE 2024-03-06 23:23:49 +08:00
Michael Milette 725e64fbf5 MDL-72923 message: Fixed levels of headings in messaging drawer. 2024-03-06 07:33:08 -05:00
Stefan Hanauska e797f1e087 MDL-69656 backup: Replace urlencoded pluginfile urls 2024-03-06 07:40:28 +01:00
Andrew Nicols 9242d13483 Merge branch 'MDL-80183-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-03-06 14:04:58 +08:00
Huong Nguyen 3d2d1e04c0 Merge branch 'MDL-80241-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-03-06 09:24:08 +07:00
Huong Nguyen 5ab684e657 Merge branch 'MDL-79278-402' of https://github.com/andelacruz/moodle into MOODLE_402_STABLE 2024-03-06 09:13:22 +07:00
Angelia Dela Cruz 337244bfb4 MDL-79278 mod_quiz: Teacher can set how quiz questions behave behat
Co-authored-by: Simey Lameze <simey@moodle.com>
2024-03-06 09:47:11 +08:00
David Mudrák 2948abf1e3 MDL-80160 admin: Fix site admins selector UI if the list is hardcoded
If the list of site admins was defined in the config.php, the UI to
select / modify admins never worked. But there was no indication of the
reason which was unexpected and confusing.
2024-03-05 23:45:16 +01:00
Sara Arjona c2b6290ed1 Merge branch 'MDL-80930-402' of https://github.com/raortegar/moodle into MOODLE_402_STABLE 2024-03-05 15:25:04 +01:00
Andrew Nicols 15a77e7519 Merge branch 'MDL-80731-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-03-05 22:06:47 +08:00
Sara Arjona 5ef6dccc02 weekly release 4.2.6+ 2024-03-05 11:22:24 +01:00
Jun Pataleta 94e7bfbd81 Merge branch 'MDL-80819_402' of https://github.com/stronk7/moodle into MOODLE_402_STABLE 2024-03-05 11:49:51 +08:00
Huong Nguyen 534e33bf0f Merge branch 'MDL-80836-402' of https://github.com/snake/moodle into MOODLE_402_STABLE 2024-03-05 10:24:26 +07:00
Paul Holden 127fb43d1f MDL-80240 gradereport_grader: fix userfields parameter to search sql. 2024-03-04 14:43:43 +00:00
Paul Holden 82644cb997 MDL-79027 block_myoverview: retrieve only course related custom fields. 2024-03-04 10:38:50 +00:00
raortegar c516fe9aac MDL-80930 core: Course delete modules task handle non deletable cms 2024-03-01 13:14:54 +01:00
Jun Pataleta 7e1ddefbd8 weekly release 4.2.6+ 2024-03-01 12:24:32 +08:00
Jun Pataleta 46ae3ce27a Merge branch 'install_402_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_402_STABLE 2024-03-01 12:24:30 +08:00
Huong Nguyen 147605bd6b Merge branch 'MDL-80364-402' of https://github.com/pedrojordao/moodle into MOODLE_402_STABLE 2024-02-29 10:45:27 +07:00
Simey Lameze 82fa5ad309 MDL-68674 behat: make content bank steps more specific 2024-02-29 09:42:46 +07:00
Andrew Nicols b543b65a20 Merge branch 'MDL-81042-42' of https://github.com/micaherne/moodle into MOODLE_402_STABLE 2024-02-29 09:22:30 +08:00
Sara Arjona 5118d7a0d4 Merge branch 'MDL-81029-402' of https://github.com/aanabit/moodle into MOODLE_402_STABLE 2024-02-28 17:22:09 +01:00
Sara Arjona 5b28ac18a6 Merge branch 'mdl-80917-402' of https://github.com/Fragonite/moodle into MOODLE_402_STABLE 2024-02-28 16:44:24 +01:00
Sara Arjona 680ebc8d36 Merge branch 'MDL-80834_402' of https://github.com/timhunt/moodle into MOODLE_402_STABLE 2024-02-28 16:34:45 +01:00
Sara Arjona 109b3ddee7 Merge branch 'MDL-80197-402' of https://github.com/pedrojordao/moodle into MOODLE_402_STABLE 2024-02-28 16:09:55 +01:00
Jun Pataleta 8e7b8281c0 Merge branch 'MDL-68674-402' of https://github.com/lucaboesch/moodle into MOODLE_402_STABLE 2024-02-28 23:03:51 +08:00
Sara Arjona 3d3fff3787 Merge branch 'MDL-52891-MOODLE_402_STABLE' of https://github.com/opitz/moodle into MOODLE_402_STABLE 2024-02-28 15:23:29 +01:00
Andrew Nicols cf46667e43 MDL-80684 core: Correct location of task tests 2024-02-28 14:21:24 +08:00
Andrew Nicols cd4e7f3fe6 Merge branch 'MDL-80684-MOODLE_402_STABLE-fail_running_tasks_on_shutdown' of https://github.com/praxisdigital/moodle into MOODLE_402_STABLE 2024-02-28 14:21:13 +08:00
AMOS bot e881931be0 Automatically generated installer lang files 2024-02-28 00:11:04 +00:00
Harry Smith 0881357dc4 MDL-80793 calendar: Setup $USER with all fields 2024-02-28 10:38:46 +13:00
Pedro Jordao da41805b5e MDL-80364 message: Change icon and background-color when item selected
Icon and background-color had contrast issues in the selected state.
2024-02-27 15:38:28 +01:00
Sara Arjona c6f6e1a496 Merge branch 'MDL-81036-402' of https://github.com/marinaglancy/moodle into MOODLE_402_STABLE 2024-02-27 13:04:14 +01:00
Matthias Opitz bf93a4c590 MDL-52891 calculatedsimple question: forcing new gen. values into form
* forcing new generated sets of wildcard values into the question edit form so they can be saved.
* added Behat test to check new generated values are used.
2024-02-27 11:16:12 +00:00
Stevani Andolo b60d42e92a MDL-80827 tool_xmldb: Fixed xmldb editor broken with PHP 8.1 2024-02-27 12:21:35 +08:00
Huong Nguyen d53011ed8c Merge branch 'MDL-78984-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-02-27 09:54:00 +07:00
Michael Aherne 7c0e7bd762 MDL-81042 quiz: Typo in renamed class. 2024-02-26 09:07:26 +00:00
Paul Holden 93102af0dd MDL-80550 cohort: get IDs for customfields correctly in external search. 2024-02-23 15:27:43 +00:00
Amaia Anabitarte d1e414d3bb MDL-81029 core_course: Fix activity settings page title 2024-02-23 16:04:54 +01:00
Marina Glancy 563081cc8f MDL-81036 behat: fix the action menu clickable area selector 2024-02-23 11:23:08 +00:00
Paul Holden d3cbf29cc6 MDL-78984 mod_assign: observe timelimit config in override form. 2024-02-23 11:18:48 +00:00
Eloy Lafuente (stronk7) 51f170fc64 MDL-80819 install: halt any install if php min version is not met
Apart from environmental stuff, the moodle_minimum_php_version_is_met()
function is executed by all installs (web, cli, database, ...)
and halts any installation (early) not meeting the PHP constraints.
2024-02-23 11:08:28 +01:00
Luca Bösch 0e3205a159 MDL-68674 theme: Have block headers have h3 class="h5". 2024-02-23 10:59:55 +01:00
Jun Pataleta c8d990de64 Merge branch 'MDL-77965-m402' of https://github.com/NeillM/moodle into MOODLE_402_STABLE 2024-02-23 17:59:38 +08:00
Paul Holden 05a7705fb2 MDL-78438 gradereport_grader: use lang string for collapsed columns. 2024-02-23 09:39:17 +00:00
Neill Magill af1e548adc MDL-77965 unit tests: Add covers annotation 2024-02-23 09:33:23 +00:00
Neill Magill ce125ae0e6 MDL-77965 quiz: Improve efficiency of the data export
Before this change the query used an index scan to perform the
export, this could be really expensive on the database.

After the change the the query will use far more efficient joins,
on a large MySQL instance this can take minutes off of the query
time.

In additon the query was returning two columns that are not used
in the function. The layout column was causing the UNION to fail
on Oracle as it cannot compare text columns, removing these
columns from the returned data should further increase
performance further.
2024-02-23 09:33:23 +00:00
Neill Magill 8f995f9adc MDL-77965 grade: Improve data export performance
The existing query was inefficient using an index scan and
index merges. This change splits the query up into many individually
much more efficient queries.

This should significantly improve performance on large sites.
2024-02-23 09:33:23 +00:00
Neill Magill 7a6e47070d MDL-77965 notes: Improve data export performance
The UNION caused the query to be run in a way that is very
inefficient on MySQL, separating the queries causes each of them to
run in a much more efficient form.

Any duplicated will be filtered out on the PHP side instead of in
the database. On large Moodle sites this is preferable as the
extract is likely to be performed on a server dedicated to running
the Moodle cron and so there will be less of effect on resources
that are used to serve end users.
2024-02-23 09:33:23 +00:00
Neill Magill fed4c20d68 MDL-77965 calendar: Improve performance of data extract
The UNION caused the query to be run in a way that is very
inefficient on MySQL, separating the queries causes each of them to
run in a much more efficient form.

Any duplicated will be filtered out on the PHP side instead of in
the database. On large Moodle sites this is preferable as the
extract is likely to be performed on a server dedicated to running
the Moodle cron and so there will be less of effect on resources
that are used to serve end users.
2024-02-23 09:33:23 +00:00
Neill Magill 6de5117a81 MDL-77965 competency: Improve query performance and data
This change removes LEFT JOINS to improve the performance
when run against Moodle sites with very large data sets.

It will also cause some additional contexts to be returned:

1. When a user has modified a user_evidence_competency
   without modifying its associated user_evidence record
2024-02-23 09:33:23 +00:00
Neill Magill 2d0c5c46b4 MDL-77965 competency: Correct order of expectations
The expected value was being passed second which meant that the
messages sent by PHPUnit when this fails are the wrong way round.
2024-02-23 09:33:23 +00:00
Jun Pataleta 8c81fa2cd3 Merge branch 'MDL-80805-m402' of https://github.com/sammarshallou/moodle into MOODLE_402_STABLE 2024-02-23 17:31:49 +08:00
Huong Nguyen 5fff172a6e weekly release 4.2.6+ 2024-02-23 08:37:50 +07:00
Huong Nguyen 294db8a3cb Merge branch 'install_402_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_402_STABLE 2024-02-23 08:37:48 +07:00
Paul Holden be46d2ee2a MDL-80183 message: improve ARIA labelling of total/unread counts. 2024-02-22 17:03:58 +00:00
Paul Holden 18acd24914 MDL-80183 message: render user online status as an accessible icon. 2024-02-22 17:01:07 +00:00
Paul Holden 3b08277ed4 MDL-80731 core: ensure valid /Lang attribute in generated PDF files.
As with the changes in 4be39296, PDF files have criteria for validity
of language identifiers.
2024-02-22 16:53:09 +00:00
Huong Nguyen b9c2b4317f Merge branch 'MDL-80844_402' of https://github.com/stronk7/moodle into MOODLE_402_STABLE 2024-02-22 11:24:12 +07:00
Huong Nguyen 714906f0b6 Merge branch 'MDL-80338-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-02-22 11:18:18 +07:00
Huong Nguyen 9070c5dfcc Merge branch 'MDL-62404_402' of https://github.com/timhunt/moodle into MOODLE_402_STABLE 2024-02-22 10:50:09 +07:00
Huong Nguyen 567e171318 Merge branch 'MDL-80868-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-02-22 10:43:31 +07:00
Huong Nguyen fec7eb792a Merge branch 'MDL-80950-402' of https://github.com/sarjona/moodle into MOODLE_402_STABLE 2024-02-22 10:40:43 +07:00
Huong Nguyen e0c3a64ecd Merge branch 'MDL-80862-402' of https://github.com/andrewnicols/moodle into MOODLE_402_STABLE 2024-02-22 10:38:02 +07:00
Huong Nguyen b488c2459b Merge branch 'MDL-80481_402' of https://github.com/santoshndev/moodle into MOODLE_402_STABLE 2024-02-22 09:51:11 +07:00
Santosh Nagargoje dc5f698fa4 MDL-80481 report: Fixed breadcrumb menu issue 2024-02-22 01:59:49 +05:30
Sara Arjona 0fc876444a Merge branch 'MDL-76441_402' of https://github.com/stronk7/moodle into MOODLE_402_STABLE 2024-02-21 17:50:02 +01:00
Sara Arjona 793e2d7e05 Merge branch 'wip_MDL-79802_m42_v8' of https://github.com/gjb2048/moodle into MOODLE_402_STABLE 2024-02-21 17:32:18 +01:00
Mark Johnson b47dcbb0cd MDL-79174 availability: Allow group condition to use hidden groups
Previously, groups with GROUP_VISIBILITY_NONE could be selected for an
availability condition, but as the group API did not return a user's own
groups with this visibility, the condition's is_available check always
failed.

This change uses the new $includehidden parameter to get all of a user's
groups from groups_get_user_groups when evaluating the condition, so
these groups work as expected. Due to the enforced hiding of conditions
containing these groups, they will never be seen by the user.
2024-02-21 15:45:39 +00:00
Mark Johnson 2d51b3dd97 MDL-79174 groups: Add includehidden parameter
This allows groups_get_user_groups to return groups with
GROUP_VISIBILITY_NONE that the specified user belongs to. The parameter
is false by default, and should be use with care as membership of these
groups should not be revealed to the user.
2024-02-21 15:45:39 +00:00
Sara Arjona 8fbbb3f4e2 Merge branch 'MDL-80605-402' of https://github.com/jbs1/moodle into MOODLE_402_STABLE 2024-02-21 16:19:23 +01:00
Sara Arjona e41340c435 Merge branch 'MDL-80404-402' of https://github.com/andelacruz/moodle into MOODLE_402_STABLE 2024-02-21 13:23:36 +01:00
Paul Holden d389c06894 MDL-80241 grade: update user filtering by matched properties.
Invert the previous logic, which maintained a "banned" list of
fields, to instead only try to filter on those fields that are
explicitly defined to support that.
2024-02-21 10:21:38 +00:00
Sara Arjona 2a439d0fae Merge branch 'MDL-78944-42' of https://github.com/Chocolate-lightning/moodle into MOODLE_402_STABLE 2024-02-21 09:19:06 +01:00
Angelia Dela Cruz cb8c663829 MDL-80404 mod_data: Behat for url autolinking and opening in new window 2024-02-21 16:02:32 +08:00
Huong Nguyen e52dae90cc Merge branch 'MDL-79792-402' of https://github.com/andelacruz/moodle into MOODLE_402_STABLE 2024-02-21 14:25:44 +07:00
Angelia Dela Cruz 387a3fdae0 MDL-79792 core_badges: Behat test for awarding badge to group members 2024-02-21 14:05:29 +08:00
Jun Pataleta 22eb4c9fe1 Merge branch 'MDL-79003-402' of https://github.com/andrewnicols/moodle into MOODLE_402_STABLE 2024-02-21 10:35:53 +08:00
Jun Pataleta b13eae06db MDL-78370 block_myoverview: Conditionally show "All" paging option
To minimise performance issues when displaying courses in Summary view,
we need to conditionally show the "All" paging option. This commit
will prevent the "All" paging option to be shown if the following
conditions are met:
- The display mode is "summary"; and
- There are more than 100 courses to be shown.
2024-02-21 09:50:02 +08:00
Juan Leyva ce9d8dcd88 MDL-79802 tool_mobile: Support new setting in the mobile app 2024-02-20 18:06:20 +00:00
Gareth Barnard a1326ff471 MDL-79802 core_h5p: Add a new setting for adding custom H5P styles. 2024-02-20 18:06:04 +00:00
Paul Holden 6df2a49db1 MDL-80919 course: initial check for section modules to duplicate. 2024-02-20 16:22:41 +00:00
Sara Arjona bb2ad26f15 Merge branch 'MDL-80912-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-02-20 15:39:29 +01:00
Paul Holden f5db45abdf MDL-80088 mod_imscp: better uploaded package filetype validation. 2024-02-20 14:10:12 +00:00
Huong Nguyen c22b8986ba MDL-76024 qtype calculated: Fix deprecation related to dynamic property 2024-02-20 12:29:48 +01:00
Paul Holden e8fa6d43a2 MDL-80865 customfield_textarea: empty check prior to exporting value.
Co-authored-by: Sara Bozzini <s.bozzini@cineca.it>
2024-02-20 10:55:01 +00:00
Huong Nguyen d6fc90e1d8 Merge branch 'MDL-80936-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-02-20 10:28:49 +07:00
Huong Nguyen f97fe5840e Merge branch 'MDL-76024-MOODLE_402_STABLE' of https://github.com/opitz/moodle into MOODLE_402_STABLE 2024-02-20 10:23:51 +07:00
Andrew Nicols 70b7730827 MDL-80862 testing: Reset task manager between behat tests 2024-02-20 10:54:55 +08:00
AMOS bot 751f1f36b2 Automatically generated installer lang files 2024-02-20 00:13:52 +00:00
Pedro Jordao 75a5a43750 MDL-80197 forms: Added attributes to the calendar link
The datepicker is not keyboard accessible when in a modal.

As we are using yui datepicker and the change is not simple, I added aria-hidden and tabindex properties to avoid screenreaders.
2024-02-19 21:12:26 -03:00
Jeremy Schulz fbbb39ca62 MDL-80605 uploaduser: fixed username already existing when mail-matching 2024-02-19 17:25:13 +01:00
Paul Holden 8f7376df56 MDL-80912 reportbuilder: output table caption when rendering reports.
Move the `get_name` method to the base report class, so that it can be
implemented by all report types. Provide a default implementation for
system reports based on the name of the class.

Use the name of the report as the caption. Target via Behat selectors.
2024-02-19 11:57:57 +00:00
Frederik Milling Pytlick cc96965b3b MDL-80684 core: Fail running tasks on shutdown
When you kill a process which is executing a task, it now marks it as failed.
2024-02-19 12:03:51 +01:00
Sara Arjona 91b453eb1d Merge branch 'MDL-79674-402' of https://github.com/junpataleta/moodle into MOODLE_402_STABLE 2024-02-19 10:20:53 +01:00
Sara Arjona c1e7ef97bc Merge branch 'MDL-80613-402' of https://github.com/lameze/moodle into MOODLE_402_STABLE 2024-02-19 09:14:32 +01:00
Matthias Opitz acaf6c5e6e MDL-76024 calculated questions: improving coding style 2024-02-16 10:23:15 +00:00
Matthias Opitz 17193ae01b MDL-76024 calculated questions: cast float type before comparison
* added calculated question for multiplication to tests/helper.php.
* added test_grading_of_negative_responses() test to question/type/calculated/tests/question_test.php
2024-02-16 10:23:15 +00:00
Eloy Lafuente (stronk7) 207bac77ab MDL-80844 phpunit: Only some tests can use the debugging sink
The only tests that have COMPLETE* support for the debugging sink
are the advanced_testcase and the database_driver ones (store and
report). So we must ensure that the rest of tests don't use the
debugging sink at all.

Right now we are using it for storing, but later there is not
reporting, so any debugging happening within non advanced tests
is not detected.

This commit just ensures that we stop making that storing for
non advanced/database_driver tests. Nothing more, nothing less.

* Note that we have had to add a few missing bits to the
database_driver testcase because it was not 100% complete. Now
it behaves 100% the same than the advanced_testcase one regarding
the debugging sink.
2024-02-15 18:46:37 +01:00
Eloy Lafuente (stronk7) f0bbfa22a2 MDL-76441 env: Moodle 4.2.x and 4.3.x do not support PHP 8.3 2024-02-15 18:45:02 +01:00
Sara Arjona e5ead3c03a MDL-80950 external: Fix PHP deprecated error for explode()
This patch fixes the following error:
PHP Deprecated:  explode(): Passing null to parameter #2 ($string)
of type string is deprecated in lib/upgradelib.php on line 1299
2024-02-15 17:52:46 +01:00
sam marshall 208298d00d MDL-80805 core_form: Accessibility - add aria-required to form fields
Most types of form field will now include aria-required="true" if the
field is marked as required. This causes assistive technology to inform
users that the field is required.

Before this change, in some cases (e.g. screen reader users tabbing
through fields) users were not informed that a field is required.
2024-02-15 15:06:09 +00:00
Sara Arjona 0f8e328e75 weekly release 4.2.6+ 2024-02-15 15:39:49 +01:00
Sara Arjona 66c760f644 Merge branch 'install_402_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_402_STABLE 2024-02-15 15:39:44 +01:00
lihidor 9cf5d56172 MDL-62404 mod_quiz: Delete previews after repaginate 2024-02-15 11:00:13 +00:00
Huong Nguyen 15c708addc Merge branch 'MDL-80823-wwwroot-redirect-MOODLE_402_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_402_STABLE 2024-02-15 11:14:20 +07:00
Simey Lameze 080a06ebb7 MDL-80613 behat: convert manual completion steps to use generators 2024-02-15 11:01:23 +08:00
Mathew May 8a51a07d11 MDL-78944 gradereport_grader: Spurious behat fix 2024-02-15 11:00:07 +08:00
Jake Dallimore f623bf2770 MDL-80836 auth_lti: take user through login instead of sesspiggyback
Browsers are phasing out 3rd party cookies. Those which can be set are
partitioned to the top level embedding site, so piggybacking is
prevented. This will break the account linking process. This fix swaps
the piggyback for a login round trip, as originally intended, which
resolves the issue.
2024-02-15 10:38:48 +08:00
Alexander Van der Bellen a7311b0c05 MDL-80917 core_backup: Clear restored course cache 2024-02-15 09:08:38 +08:00
Paul Holden 15b96af24d MDL-80936 reportbuilder: fix when default customfield values are shown.
We should ensure we only show a value for the custom field (default or
otherwise) when it's actually joined to an entity it represents.
2024-02-14 12:30:58 +00:00
Sara Arjona 3ff231c1d4 Merge branch 'MDL-79321-402' of https://github.com/andelacruz/moodle into MOODLE_402_STABLE 2024-02-14 09:35:32 +01:00
Angelia Dela Cruz 7b243f53cc MDL-79321 mod_quiz: Behat to set quiz as interactive with multiple tries 2024-02-13 16:56:56 +08:00
Jun Pataleta 6d474f0170 Merge branch 'MDL-80402-402' of https://github.com/andelacruz/moodle into MOODLE_402_STABLE 2024-02-13 15:52:01 +08:00
Jun Pataleta ddcae16efb Merge branch 'MDL-80766-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-02-13 15:33:59 +08:00
Angelia Dela Cruz 69cf7cf56a MDL-80402 mod_quiz: Behat for interactive quiz question dependency 2024-02-13 15:19:43 +08:00
Huong Nguyen 363150d771 Merge branch 'MDL-80869-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2024-02-13 09:14:56 +07:00
AMOS bot a1d797b2d8 Automatically generated installer lang files 2024-02-13 00:10:24 +00:00
AMOS bot 116322c4c6 Automatically generated installer lang files 2024-02-12 00:11:17 +00:00
Paul Holden 81cac56362 MDL-80868 question: correct deleted format plugin definitions. 2024-02-08 16:15:33 +00:00
Paul Holden 7bfd7fe95f MDL-80869 mod_bigbluebuttonbn: ensure test retrieves expected record. 2024-02-08 13:22:33 +00:00
Brendan Heywood 67cbdbcf0b MDL-80823 core: Redirect to wwwroot with full path 2024-02-08 12:08:14 +11:00
Paul Holden da92cd6e76 MDL-80338 core: encode moodle_url instance anchor properties. 2024-02-07 12:21:38 +00:00
Tim Hunt 2fb1311389 MDL-80834 quiz editing: fix position of the 'depends on previous' icon 2024-02-06 11:31:57 +00:00
Paul Holden d8bec7a090 MDL-80766 gradereport_grader: omit max constraint for unlimited grades. 2024-01-31 18:26:42 +00:00
Jun Pataleta da0f7544fa MDL-79674 behat: Use proper tags for testing WCAG 2.1 criteria
`wcag2a` and `wcag2aa` refer to WCAG 2.0 standards. We should be using
`wcag21a` and `wcag21aa` to test against WCAG 2.1 standards.

See:
https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#axe-core-tags
2024-01-30 16:20:28 +08:00
Jun Pataleta 1091ff1f12 MDL-79674 behat: axe-core version fixes
* Update \behat_accessibility::run_axe_validation_for_tags()'s
  PHPDoc block to reflect the current version.
* Fix incorrect copyright tag for the library
2024-01-30 16:20:26 +08:00
Andrew Nicols 3bea8ad014 MDL-79003 js: Bump stylelint and components
Stylelint 15 deprecates a heap of rules which will be removed in 16.

We can't use 16 because it's ESM and requires a big restructure of our
build process.

We can temporarily silence the deprecations and then when we update our
build tooling we can make use of @stylistic/stylelint-plugin to add the
rules back.

This commit:
- bumps stylelint and related dependencies accordingly
- fixes issues identified with newer sniffs
- temporarily silences deprecation warnings
2024-01-30 13:32:46 +08:00
Andrew Nicols bb64ff0b0f MDL-79003 js: Move rollup ratelimit to generateBundle
There are two phases of a build: Building, and then Outputting.

We were previously listening on the final event for the build phase, but
we should be listening to the final event of the output phase.
2024-01-30 13:32:45 +08:00
Andrew Nicols 3bb4bc5bb5 MDL-79003 js: Move browserlist config to package.json 2024-01-30 13:32:45 +08:00
Andrew Nicols e48494696d MDL-79003 js: Standard package bump - glob 2024-01-30 13:32:45 +08:00
Andrew Nicols b3f2e372c4 MDL-79003 js: Standard package bump - async 2024-01-30 13:32:45 +08:00
Andrew Nicols 53f53e2424 MDL-79003 js: Remove grunt-contrib-uglify
We stopped using this when we updated our processes to support ESMs in
MDL-62497. Removal of the dependency was missed at the time.
2024-01-30 13:32:45 +08:00
Andrew Nicols 4c10eb14d8 MDL-79003 js: Standard package bump - grunt 2024-01-30 13:32:44 +08:00
Andrew Nicols b4858a4237 MDL-79003 js: Standard package bump - watchman 2024-01-30 13:32:44 +08:00
Andrew Nicols 6c80395a44 MDL-79003 js: Standard package bump - ajv 2024-01-30 13:32:44 +08:00
Andrew Nicols 00a7b14c0e MDL-79003 js: Use our own jsdoc wrapper
grunt-jsdoc is abandoned and only works with an older version of jsdoc.

This is a very simple wrapper around jsdoc itself.

This commit also includes a fix for broken docs.
2024-01-30 13:32:44 +08:00
Andrew Nicols 527944c274 MDL-79003 core: Bump eslint 2024-01-30 13:32:43 +08:00
Ruslan Kabalin 95458aa709 MDL-79003 eslint: Enable 'reportUnusedDisableDirectives' eslint setting
This commit is a backport of MDL-74301 which should have been backported
at the time.

This will warn on unused /* eslint-disable */ statements.
2024-01-30 13:32:34 +08:00
Ruslan Kabalin deb801fadc MDL-79003 eslint: Remove rules included in eslint:recommended
This commit is a backport of MDL-74301 which should have been backported
at the time.

All rules included in "eslint:recommended" set containing matching
values are removed from the list. Recommended set is defined in
node_modules/eslint/conf/eslint-recommended.js
2024-01-30 13:32:29 +08:00
Ruslan Kabalin b3445f0c83 MDL-79003 eslint: Remove deprecated rules.
This commit is a backport of MDL-74301 which should have been backported
at the time.

To identify deprecated rules, temporary install sarbbottam/eslint-find-rules, then run
`npx eslint-find-rules -d .eslintrc`, it will return a list of rules
defined in .eslintrc that were deprecated.
2024-01-30 13:32:18 +08:00
Ruslan Kabalin 266083b359 MDL-79003 eslint: Refactor jsdoc rules.
This commit is a backport of MDL-74301 which should have been backported
at the time.

Adding 'plugin:promise/recommended' results in 5k+ jsdoc warnings most
of which includes missing return and naming preferences (e.g. 'returns'
over 'return' or 'string' over 'String'). This needs to be audited and
addressed seprately.
2024-01-30 13:32:13 +08:00
Ruslan Kabalin 70e3dc44ef MDL-79003 eslint: Use 'plugin:promise/recommended'
This commit is a backport of MDL-74301 which should have been backported
at the time.

This enables recommended rules and brings back related rules. Without
reducing level to warn for some of them, this gives numerous (about 88) issues mainly
catch-or-return. Recommended set is defined in
node_modules/eslint-plugin-promise/index.js
2024-01-30 13:32:07 +08:00
Ruslan Kabalin 1e242956cc MDL-79003 eslint: Address issues reported by eslint
This commit is a backport of MDL-74301 which should have been backported
at the time.
2024-01-30 13:32:00 +08:00
Ruslan Kabalin 47bc3254c8 MDL-79003 eslint: Change configuration and use 'eslint:recommended'
This commit is a backport of MDL-74301 which should have been backported
at the time.
2024-01-30 13:31:41 +08:00
Ruslan Kabalin 8b85e34fbf MDL-79003 eslint: Upgrade eslint and babel
This commit is a backport of MDL-74301 which should have been backported
at the time.

This patch includes changes:
* Upgrade "@babel/core" to latest point release
* Remove plugins already included into current "@babel/preset-env":
  - "@babel/plugin-proposal-class-properties"
  - "@babel/plugin-proposal-json-strings"
  - "@babel/plugin-syntax-dynamic-import"
  - "@babel/plugin-syntax-import-meta"
* Upgrade "eslint" to latest version
* Replace "eslint-plugin-babel" (depreacted in 2019) with "@babel/eslint-parser" and "@babel/eslint-plugin"
2024-01-30 12:23:36 +08:00
Andrew Nicols 25c5ed6ea3 MDL-79003 core: Bump NodeJS to lts/iron (NodeJS 20) 2024-01-30 12:21:33 +08:00
762 changed files with 14603 additions and 15946 deletions
+30 -93
View File
@@ -1,8 +1,12 @@
{
'plugins': [
'babel',
'@babel',
'promise',
'jsdoc',
'jsdoc'
],
'extends': [
'eslint:recommended',
'plugin:promise/recommended'
],
'env': {
'browser': true,
@@ -16,42 +20,19 @@
'M': true,
'Y': true
},
// Warn about unused eslint-disable statements.
'reportUnusedDisableDirectives': true,
'rules': {
// See http://eslint.org/docs/rules/ for all rules and explanations of all
// rules.
// === Possible Errors ===
'comma-dangle': 'off',
'no-compare-neg-zero': 'error',
'no-cond-assign': 'error',
'no-console': 'error',
'no-constant-condition': 'error',
'no-control-regex': 'error',
'no-debugger': 'error',
'no-dupe-args': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-empty': 'warn',
'no-empty-character-class': 'error',
'no-ex-assign': 'error',
'no-extra-boolean-cast': 'error',
'no-extra-parens': 'off',
'no-extra-semi': 'error',
'no-func-assign': 'error',
'no-inner-declarations': 'error',
'no-invalid-regexp': 'error',
'no-irregular-whitespace': 'error',
'no-obj-calls': 'error',
'no-prototype-builtins': 'off',
'no-regex-spaces': 'error',
'no-sparse-arrays': 'error',
'no-unexpected-multiline': 'error',
'no-unreachable': 'warn',
'no-unsafe-finally': 'error',
'no-unsafe-negation': 'error',
'use-isnan': 'error',
'valid-jsdoc': ['warn', { 'requireReturn': false, 'requireParamDescription': false, 'requireReturnDescription': false }],
'valid-typeof': 'error',
// === Best Practices ===
// (these mostly match our jshint config)
@@ -63,15 +44,12 @@
'dot-notation': 'warn',
'no-alert': 'warn',
'no-caller': 'error',
'no-case-declarations': 'error',
'no-div-regex': 'error',
'no-empty-pattern': 'error',
'no-empty-function': 'warn',
'no-eq-null': 'error',
'no-eval': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'warn',
'no-fallthrough': 'error',
'no-floating-decimal': 'warn',
'no-global-assign': 'warn',
'no-implied-eval': 'error',
@@ -83,28 +61,22 @@
'no-multi-str': 'error',
'no-new-func': 'error',
'no-new-wrappers': 'error',
'no-octal': 'error',
'no-octal-escape': 'error',
'no-proto': 'error',
'no-redeclare': 'warn',
'no-restricted-globals': ['error', { 'name': 'Notification' }],
'no-return-assign': 'error',
'no-script-url': 'error',
'no-self-assign': 'error',
'no-self-compare': 'error',
'no-sequences': 'warn',
'no-throw-literal': 'warn',
'no-unmodified-loop-condition': 'error',
'no-unused-expressions': 'error',
'no-unused-labels': 'error',
'no-useless-call': 'warn',
'no-useless-escape': 'warn',
'no-with': 'error',
'wrap-iife': ['error', 'any'],
// === Variables ===
'no-delete-var': 'error',
'no-undef': 'error',
'no-undef-init': 'error',
'no-unused-vars': ['error', { 'caughtErrors': 'none' }],
@@ -137,8 +109,6 @@
'max-statements-per-line': ['warn', { max: 2 }],
'new-cap': ['warn', { 'properties': false }],
'new-parens': 'warn',
'newline-after-var': 'off',
'newline-before-return': 'off',
'newline-per-chained-call': 'off',
'no-array-constructor': 'off',
'no-bitwise': 'error',
@@ -146,7 +116,6 @@
'no-inline-comments': 'off',
'no-lonely-if': 'off',
'no-mixed-operators': 'off',
'no-mixed-spaces-and-tabs': 'error',
'no-multiple-empty-lines': 'warn',
'no-negated-condition': 'off',
'no-nested-ternary': 'warn',
@@ -168,7 +137,6 @@
'padded-blocks': 'off',
'quote-props': ['warn', 'as-needed', {'unnecessary': false, 'keywords': true, 'numbers': true}],
'quotes': 'off',
'require-jsdoc': 'warn',
'semi': 'error',
'semi-spacing': ['warn', {'before': false, 'after': true}],
'sort-vars': 'off',
@@ -181,21 +149,19 @@
'unicode-bom': 'error',
'wrap-regex': 'off',
// === Promises ===
// === Promises (override plugin:promise/recommended) ===
'promise/always-return': 'warn',
'promise/no-return-wrap': 'warn',
'promise/param-names': 'warn',
'promise/catch-or-return': ['warn', {terminationMethod: ['catch', 'fail']}],
'promise/no-native': 'warn',
'promise/no-promise-in-callback': 'warn',
'promise/no-callback-in-promise': 'warn',
'promise/avoid-new': 'warn',
// === Deprecations ===
"no-restricted-properties": ['warn', {
'object': 'M',
'property': 'str',
'message': 'Use AMD module "core/str" or M.util.get_string()'
'message': 'Use "core/str" module or M.util.get_string()'
}],
},
overrides: [
@@ -235,7 +201,6 @@
parser: '@babel/eslint-parser',
// Check AMD with some slightly stricter rules.
rules: {
'no-unused-vars': 'error',
'no-implicit-globals': 'error',
// Disable all of the rules that have babel versions.
'new-cap': 'off',
@@ -247,65 +212,37 @@
'semi': 'off',
'no-unused-expressions': 'off',
// Enable all of the babel version of these rules.
'babel/new-cap': ['warn', { 'properties': false }],
'@babel/new-cap': ['warn', { 'properties': false }],
// Not using this rule for the time being because it isn't
// compatible with jQuery and ES6.
'babel/no-invalid-this': 'off',
'babel/object-curly-spacing': 'warn',
// This is off in the original style int.
'babel/quotes': 'off',
'babel/semi': 'error',
'babel/no-unused-expressions': 'error',
'@babel/no-invalid-this': 'off',
'@babel/object-curly-spacing': 'warn',
'@babel/semi': 'error',
'@babel/no-unused-expressions': 'error',
// === Promises ===
// We have Promise now that we're using ES6.
'promise/no-native': 'off',
'promise/avoid-new': 'off',
// === JSDocs ===
"jsdoc/check-access": [
'error',
],
"jsdoc/check-alignment": 1, // Recommended.
"jsdoc/check-param-names": [
'error',
],
"jsdoc/check-property-names": [
'error',
],
"jsdoc/empty-tags": [
'error',
],
"jsdoc/implements-on-classes": [
'error',
],
"jsdoc/multiline-blocks": [
'error',
],
"jsdoc/require-jsdoc": [
'error',
],
"jsdoc/require-param": [
'error',
],
"jsdoc/require-param-name": [
'error',
],
"jsdoc/require-param-type": [
'error',
],
"jsdoc/require-property": [
'error',
],
"jsdoc/require-property-name": [
'error',
],
"jsdoc/require-property-type": [
'error',
],
'jsdoc/check-access': 'error',
'jsdoc/check-alignment': 1, // Recommended.
'jsdoc/check-param-names': 'error',
'jsdoc/check-property-names': 'error',
'jsdoc/empty-tags': 'error',
'jsdoc/implements-on-classes': 'error',
'jsdoc/multiline-blocks': 'error',
'jsdoc/require-jsdoc': 'error',
'jsdoc/require-param': 'error',
'jsdoc/require-param-name': 'error',
'jsdoc/require-param-type': 'error',
'jsdoc/require-property': 'error',
'jsdoc/require-property-name': 'error',
'jsdoc/require-property-type': 'error'
},
parserOptions: {
'sourceType': 'module',
'requireConfigFile': false,
'requireConfigFile': false
}
}
]
+1 -1
View File
@@ -3,7 +3,7 @@ name: Core
on:
push:
branches-ignore:
- master
- main
- MOODLE_[0-9]+_STABLE
tags-ignore:
- v[0-9]+.[0-9]+.[0-9]+*
+7 -19
View File
@@ -21,7 +21,7 @@
*/
/**
* Function to generate the destination for the uglify task
* Function to generate the destination for the minification task
* (e.g. build/file.min.js). This function will be passed to
* the rename property of files array when building dynamically:
* http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically
@@ -60,7 +60,6 @@ module.exports = grunt => {
grunt.registerTask('js', ['amd', 'yui']);
// Register NPM tasks.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-rollup');
@@ -104,6 +103,7 @@ module.exports = grunt => {
// The queue runner will run the next `size` items in the queue.
const runQueue = (size = 1) => {
queue.splice(0, size).forEach(resolve => {
grunt.log.debug(`Item resolved. Kicking off next one.`);
resolve();
});
};
@@ -113,15 +113,17 @@ module.exports = grunt => {
// The options hook is run in parallel.
// We can return an unresolved Promise which is queued for later resolution.
options: async() => {
options: async(options) => {
return new Promise(resolve => {
queue.push(resolve);
startQueue();
return options;
});
},
// When an item in the queue completes, start the next item in the queue.
buildEnd: () => {
generateBundle: (options, bundle) => {
grunt.log.debug(`Finished output phase for ${Object.keys(bundle).join(', ')}`);
runQueue();
},
};
@@ -151,24 +153,10 @@ module.exports = grunt => {
//
// It also adds the Moodle plugin name to the AMD module definition
// so that it can be imported as expected in other modules.
path.resolve('.grunt/babel-plugin-add-module-to-define.js'),
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-syntax-import-meta',
['@babel/plugin-proposal-class-properties', {'loose': false}],
'@babel/plugin-proposal-json-strings'
path.resolve('.grunt/babel-plugin-add-module-to-define.js')
],
presets: [
['@babel/preset-env', {
targets: {
browsers: [
">0.3%",
"last 2 versions",
"not ie >= 0",
"not op_mini all",
"not Opera > 0",
"not dead"
]
},
modules: false,
useBuiltIns: false
}]
+28 -12
View File
@@ -20,17 +20,33 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
// Project configuration.
grunt.config.merge({
jsdoc: {
dist: {
options: {
configure: ".grunt/jsdoc/jsdoc.conf.js",
},
},
},
});
module.exports = (grunt) => {
const path = require('path');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.registerTask('jsdoc', 'Generate JavaScript documentation using jsdoc', function() {
const done = this.async();
const configuration = path.resolve('.grunt/jsdoc/jsdoc.conf.js');
grunt.util.spawn({
cmd: 'jsdoc',
args: [
'--configure',
configuration,
]
}, function(error, result, code) {
if (result.stdout) {
grunt.log.write(result.stdout);
}
if (result.stderr) {
grunt.log.error(result.stderr);
}
if (error) {
grunt.fail.fatal(`JSDoc failed with error code ${code}`);
} else {
grunt.log.write('JSDoc completed successfully'.green);
}
done();
});
});
};
+5 -1
View File
@@ -29,6 +29,7 @@ module.exports = grunt => {
// Use a fully-qualified path.
src: files,
options: {
quietDeprecationWarnings: true,
configOverrides: {
rules: {
// These rules have to be disabled in .stylelintrc for scss compat.
@@ -45,7 +46,10 @@ module.exports = grunt => {
return {
stylelint: {
scss: {
options: {syntax: 'scss'},
options: {
quietDeprecationWarnings: true,
customSyntax: 'postcss-scss',
},
src: files,
},
},
+1 -1
View File
@@ -1 +1 @@
lts/gallium
lts/iron
+16 -4
View File
@@ -1,9 +1,14 @@
{
"customSyntax": "postcss-scss",
"plugins": [
"stylelint-csstree-validator"
],
"rules": {
"csstree/validator": true,
"csstree/validator": {
"syntaxExtensions": [
"sass"
]
},
"at-rule-empty-line-before": [ "always",
{"except": [ "blockless-after-blockless"], ignore: ["after-comment", "inside-block"]}
],
@@ -45,7 +50,7 @@
"function-name-case": "lower",
"function-parentheses-newline-inside": "always-multi-line",
"function-parentheses-space-inside": "never-single-line",
"function-url-scheme-blacklist": ["data"],
"function-url-scheme-disallowed-list": ["data"],
"function-whitespace-after": "always",
"indentation": 4,
"keyframe-declaration-no-important": true,
@@ -84,12 +89,19 @@
"selector-type-no-unknown": true,
"string-no-newline": true,
"time-min-milliseconds": 100,
"unit-blacklist": ["pt"],
"unit-disallowed-list": ["pt"],
"unit-case": "lower",
"unit-no-unknown": true,
"value-keyword-case": ["lower", {"ignoreKeywords": ["/(@|$)/"]}],
"value-list-comma-newline-after": "always-multi-line",
"value-list-comma-space-after": "always-single-line",
"value-list-comma-space-before": "never",
}
},
"overrides": [
{
"files": ["**/yui/**/*.css"],
"rules": {
}
}
]
}
@@ -500,4 +500,15 @@ abstract class plugin_management_table extends flexible_table implements dynamic
protected function supports_ordering(): bool {
return $this->plugininfoclass::plugintype_supports_ordering();
}
/**
* Check if the user has the capability to access this table.
*
* Default implementation for plugin management tables is to require 'moodle/site:config' capability
*
* @return bool Return true if capability check passed.
*/
public function has_capability(): bool {
return has_capability('moodle/site:config', $this->get_context());
}
}
+207
View File
@@ -3923,6 +3923,8 @@
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_xmlrpc_usage" level="optional">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_oracle_usage" level="optional">
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="4.2" requires="3.11.8">
@@ -3939,6 +3941,7 @@
<VENDOR name="oracle" version="19" />
</DATABASE>
<PHP version="8.0.0" level="required">
<RESTRICT function="restrict_php_version_83" message="unsupportedphpversion83" />
</PHP>
<PCREUNICODE level="optional">
<FEEDBACK>
@@ -4112,6 +4115,8 @@
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mod_assignment" level="required">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_oracle_usage" level="optional">
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="4.3" requires="3.11.8">
@@ -4128,6 +4133,7 @@
<VENDOR name="oracle" version="19" />
</DATABASE>
<PHP version="8.0.0" level="required">
<RESTRICT function="restrict_php_version_83" message="unsupportedphpversion83" />
</PHP>
<PCREUNICODE level="optional">
<FEEDBACK>
@@ -4303,6 +4309,8 @@
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_db_prefix_length" level="required">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_oracle_usage" level="optional">
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="4.4" requires="4.1.2">
@@ -4494,6 +4502,205 @@
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_db_prefix_length" level="required">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_oracle_usage" level="optional">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_async_backup" level="recommended">
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="4.5" requires="4.1.2">
<UNICODE level="required">
<FEEDBACK>
<ON_ERROR message="unicoderequired" />
</FEEDBACK>
</UNICODE>
<DATABASE level="required">
<VENDOR name="mariadb" version="10.6.7" />
<VENDOR name="mysql" version="8.0" />
<VENDOR name="postgres" version="13" />
<VENDOR name="mssql" version="14.0" />
<VENDOR name="oracle" version="19" />
</DATABASE>
<PHP version="8.1.0" level="required">
</PHP>
<PCREUNICODE level="optional">
<FEEDBACK>
<ON_CHECK message="pcreunicodewarning" />
</FEEDBACK>
</PCREUNICODE>
<PHP_EXTENSIONS>
<PHP_EXTENSION name="iconv" level="required">
<FEEDBACK>
<ON_ERROR message="iconvrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="mbstring" level="required">
<FEEDBACK>
<ON_ERROR message="mbstringrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="curl" level="required">
<FEEDBACK>
<ON_ERROR message="curlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="openssl" level="required">
<FEEDBACK>
<ON_ERROR message="opensslrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="tokenizer" level="optional">
<FEEDBACK>
<ON_CHECK message="tokenizerrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="soap" level="optional">
<FEEDBACK>
<ON_CHECK message="soaprecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="ctype" level="required">
<FEEDBACK>
<ON_ERROR message="ctyperequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zip" level="required">
<FEEDBACK>
<ON_ERROR message="ziprequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zlib" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="gd" level="required">
<FEEDBACK>
<ON_ERROR message="gdrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="simplexml" level="required">
<FEEDBACK>
<ON_ERROR message="simplexmlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="spl" level="required">
<FEEDBACK>
<ON_ERROR message="splrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="pcre" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="dom" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xml" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlreader" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="intl" level="required">
<FEEDBACK>
<ON_ERROR message="intlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="json" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="hash" level="required"/>
<PHP_EXTENSION name="fileinfo" level="required"/>
<PHP_EXTENSION name="sodium" level="required"/>
<PHP_EXTENSION name="exif" level="optional"/>
</PHP_EXTENSIONS>
<PHP_SETTINGS>
<PHP_SETTING name="memory_limit" value="96M" level="required">
<FEEDBACK>
<ON_ERROR message="settingmemorylimit" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="file_uploads" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="settingfileuploads" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="opcache.enable" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="opcacherecommended" />
</FEEDBACK>
</PHP_SETTING>
</PHP_SETTINGS>
<CUSTOM_CHECKS>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbstorageengine" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
<FEEDBACK>
<ON_ERROR message="quizattemptsupgradedmessage" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
<FEEDBACK>
<ON_CHECK message="slashargumentswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
<FEEDBACK>
<ON_CHECK message="unsupporteddbtablerowformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_unoconv_version" level="optional">
<FEEDBACK>
<ON_CHECK message="unoconvwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
<FEEDBACK>
<ON_CHECK message="libcurlwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_format" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbfileformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_per_table" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbfilepertable" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_large_prefix" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddblargeprefix" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_is_https" level="optional">
<FEEDBACK>
<ON_CHECK message="ishttpswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_incomplete_unicode_support" level="optional">
<FEEDBACK>
<ON_CHECK message="incompleteunicodesupport" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_sixtyfour_bits" level="required">
<FEEDBACK>
<ON_ERROR message="sixtyfourbitsrequired" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_max_input_vars" level="optional">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_admin_dir_usage" level="optional">
<FEEDBACK>
<ON_CHECK message="iscustomadminwarnings" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_xmlrpc_usage" level="optional">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mod_assignment" level="required">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_db_prefix_length" level="required">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_oracle_usage" level="optional">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_async_backup" level="recommended">
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
</COMPATIBILITY_MATRIX>
+5 -2
View File
@@ -2051,8 +2051,10 @@ class core_admin_renderer extends plugin_renderer_base {
// We are checking installed & enabled things
if ($environment_result->getLevel() == 'required') {
$stringtouse = 'environmentrequirecustomcheck';
} else {
} else if ($environment_result->getLevel() == 'optional') {
$stringtouse = 'environmentrecommendcustomcheck';
} else {
$stringtouse = 'environmentshouldfixcustomcheck';
}
} else if ($environment_result->getPart() == 'php_setting') {
@@ -2083,7 +2085,8 @@ class core_admin_renderer extends plugin_renderer_base {
if ($status) { //Handle ok result (ok)
$status = get_string('statusok');
} else {
if ($environment_result->getLevel() == 'optional') {//Handle check result (warning)
// Handle check result (warning).
if (in_array($environment_result->getLevel(), ['optional', 'recommended'])) {
$status = get_string('check');
$warningline = true;
} else { //Handle error result (error)
+16
View File
@@ -38,6 +38,22 @@ if (!is_siteadmin()) {
}
$admisselector = new core_role_admins_existing_selector();
if (array_key_exists('siteadmins', $CFG->config_php_settings)) {
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('manageadmins', 'core_role'), 3);
echo $OUTPUT->notification(get_string('siteadministratorsconfigphp', 'core_role'), \core\output\notification::NOTIFY_INFO);
echo $OUTPUT->box_start();
echo html_writer::tag(
'p',
get_string('existingadmins', 'core_role'),
);
$admisselector->display();
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
die();
}
$potentialadmisselector = new core_role_admins_potential_selector();
if ($addusersaction) {
+14
View File
@@ -41,4 +41,18 @@ if (!empty($defaulth5plib)) {
$settings->add(new admin_settings_h5plib_handler_select('h5plibraryhandler', new lang_string('h5plibraryhandler', 'core_h5p'),
new lang_string('h5plibraryhandler_help', 'core_h5p'), $defaulth5plib));
$setting = new admin_setting_configtextarea(
'core_h5p/h5pcustomcss',
new lang_string('h5pcustomcss', 'core_h5p'),
new lang_string('h5pcustomcss_help', 'core_h5p'),
'',
PARAM_NOTAGS
);
$setting->set_updatedcallback(function () {
// Enables use of file_storage constants.
\core_h5p\local\library\autoloader::register();
\core_h5p\file_storage::generate_custom_styles();
});
$settings->add($setting);
}
+2 -1
View File
@@ -152,7 +152,8 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$sensiblesettingsdefault .= 'server_password@@search_solr, ssl_keypassword@@search_solr, ';
$sensiblesettingsdefault .= 'alternateserver_password@@search_solr, alternatessl_keypassword@@search_solr, ';
$sensiblesettingsdefault .= 'test_password@@cachestore_redis, password@@mlbackend_python, ';
$sensiblesettingsdefault .= 'badges_badgesalt@@none, calendar_exportsalt@@none';
$sensiblesettingsdefault .= 'badges_badgesalt@@none, calendar_exportsalt@@none, ';
$sensiblesettingsdefault .= 'bigbluebuttonbn_shared_secret@@none';
$temp->add(new admin_setting_configtextarea('adminpresets/sensiblesettings',
get_string('sensiblesettings', 'core_adminpresets'),
get_string('sensiblesettingstext', 'core_adminpresets'),
+3 -3
View File
@@ -18,7 +18,7 @@ Feature: An administrator can browse user accounts
When I navigate to "Users > Accounts > Browse list of users" in site administration
# Name field always present, email field is default for showidentity.
Then the following should exist in the "users" table:
| First name / Last name | Email address |
| First name | Email address |
| User One | one@example.com |
| User Two | two@example.com |
# Should not see other identity fields or non-default name fields.
@@ -34,7 +34,7 @@ Feature: An administrator can browse user accounts
| alternativefullnameformat | firstnamephonetic lastname |
When I navigate to "Users > Accounts > Browse list of users" in site administration
Then the following should exist in the "users" table:
| First name - phonetic / Last name | Email address |
| First name - phonetic | Email address |
| Yewzer One | one@example.com |
| Yoozare Two | two@example.com |
@@ -43,7 +43,7 @@ Feature: An administrator can browse user accounts
| showuseridentity | department,profile_field_frog |
When I navigate to "Users > Accounts > Browse list of users" in site administration
Then the following should exist in the "users" table:
| First name / Last name | Favourite frog | Department |
| First name | Favourite frog | Department |
| User One | Kermit | Attack |
| User Two | Tree | Defence |
And I should not see "Email address" in the "table" "css_element"
-22
View File
@@ -48,25 +48,3 @@ Feature: View task logs report and use its filters
| operator | shouldornotsee |
| Less than | should not see |
| Greater than | should see |
@javascript
Scenario: Reset task log filters
Given I log in as "admin"
And I change window size to "large"
And I navigate to "Server > Tasks > Task logs" in site administration
When I click on "Filters" "button"
And I set the following fields in the "Result" "core_reportbuilder > Filter" to these values:
| Result operator | Is equal to |
| Result value | Fail |
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
Then I should see "Filters applied"
And I should see "Filters (1)" in the "#dropdownFiltersButton" "css_element"
And I should see "Nothing to display"
And I click on "Reset all" "button" in the "[data-region='report-filters']" "css_element"
And I should see "Filters reset"
And I should not see "Filters (1)" in the "#dropdownFiltersButton" "css_element"
And I should see "Filters" in the "#dropdownFiltersButton" "css_element"
And "[data-region='report-filters']" "css_element" should be visible
And the following fields in the "Result" "core_reportbuilder > Filter" match these values:
| Result operator | Is any value |
And I should not see "Nothing to display"
@@ -65,7 +65,7 @@ class delete extends base {
* Delete the DB preset
*/
public function execute(): void {
confirm_sesskey();
require_sesskey();
$this->manager->delete_preset($this->id);
@@ -52,8 +52,6 @@ class export extends base {
* Stores a preset into the DB.
*/
public function execute(): void {
confirm_sesskey();
$url = new \moodle_url('/admin/tool/admin_presets/index.php', ['action' => 'export', 'mode' => 'execute']);
$this->moodleform = new export_form($url);
@@ -87,7 +85,7 @@ class export extends base {
* @throws xml_writer_exception
*/
public function download_xml(): void {
confirm_sesskey();
require_sesskey();
list($xmlstr, $filename) = $this->manager->download_preset($this->id);
@@ -40,8 +40,6 @@ class import extends base {
* Imports the xmlfile into DB
*/
public function execute(): void {
confirm_sesskey();
$url = new \moodle_url('/admin/tool/admin_presets/index.php', ['action' => 'import', 'mode' => 'execute']);
$this->moodleform = new import_form($url);
@@ -38,8 +38,6 @@ class load extends base {
public function execute(): void {
global $OUTPUT;
confirm_sesskey();
$url = new \moodle_url('/admin/tool/admin_presets/index.php', ['action' => 'load', 'mode' => 'execute']);
$this->moodleform = new load_form($url);
@@ -73,7 +73,7 @@ class rollback extends base {
public function execute(): void {
global $OUTPUT;
confirm_sesskey();
require_sesskey();
list($presetapp, $rollback, $failures) = $this->manager->revert_preset($this->id);
@@ -5,16 +5,18 @@ Feature: I can download a preset
| name |
| Custom preset |
@javascript
Scenario: Custom preset settings can be downloaded
Given I log in as "admin"
And I navigate to "Site admin presets" in site administration
When I open the action menu in "Custom preset" "table_row"
Then following "Download" "link" in the "Custom preset" "table_row" should download between "0" and "5000" bytes
Then following "Download" in the "Custom preset" "table_row" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | Custom preset |
@javascript
Scenario: Core preset settings can be downloaded
Given I log in as "admin"
And I navigate to "Site admin presets" in site administration
When I open the action menu in "Starter" "table_row"
Then following "Download" "link" in the "Starter" "table_row" should download between "0" and "5000" bytes
Then following "Download" in the "Starter" "table_row" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | Starter |
+7 -7
View File
@@ -97,28 +97,28 @@ if ($onlycli === false) {
switch ($action) {
case 'enable':
confirm_sesskey();
require_sesskey();
$model->enable();
redirect($returnurl);
break;
case 'disable':
confirm_sesskey();
require_sesskey();
$model->update(0, false, false);
redirect($returnurl);
break;
case 'delete':
confirm_sesskey();
require_sesskey();
$model->delete();
redirect($returnurl);
break;
case 'edit':
confirm_sesskey();
require_sesskey();
$invalidcurrenttimesplitting = $model->invalid_timesplitting_selected();
$potentialtimesplittings = $model->get_potential_timesplittings();
@@ -183,7 +183,7 @@ switch ($action) {
break;
case 'evaluate':
confirm_sesskey();
require_sesskey();
if ($model->is_static()) {
throw new moodle_exception('errornostaticevaluate', 'tool_analytics');
@@ -226,7 +226,7 @@ switch ($action) {
break;
case 'scheduledanalysis':
confirm_sesskey();
require_sesskey();
if ($onlycli) {
throw new moodle_exception('erroronlycli', 'tool_analytics');
@@ -292,7 +292,7 @@ switch ($action) {
break;
case 'clear':
confirm_sesskey();
require_sesskey();
$model->clear();
redirect($returnurl);
@@ -155,9 +155,9 @@ class data_request extends persistent {
case api::DATAREQUEST_STATUS_EXPIRED:
$result = true;
break;
// Complete requests are expired if the expiry time has elapsed.
// Complete requests are expired if the expiry time is a positive value, and has elapsed.
case api::DATAREQUEST_STATUS_DOWNLOAD_READY:
$expiryseconds = get_config('tool_dataprivacy', 'privacyrequestexpiry');
$expiryseconds = (int) get_config('tool_dataprivacy', 'privacyrequestexpiry');
if ($expiryseconds > 0 && time() >= ($request->get('timemodified') + $expiryseconds)) {
$result = true;
}
@@ -178,7 +178,12 @@ class data_request extends persistent {
public static function get_expired_requests($userid = 0) {
global $DB;
$expiryseconds = get_config('tool_dataprivacy', 'privacyrequestexpiry');
// Complete requests are expired if the expiry time is a positive value, and has elapsed.
$expiryseconds = (int) get_config('tool_dataprivacy', 'privacyrequestexpiry');
if ($expiryseconds <= 0) {
return [];
}
$expirytime = strtotime("-{$expiryseconds} second");
$table = self::TABLE;
$sqlwhere = 'type = :export_type AND status = :completestatus AND timemodified <= :expirytime';
@@ -45,7 +45,7 @@ $string['cachedef_purpose'] = 'Data purposes';
$string['cachedef_purpose_overrides'] = 'Purpose overrides in the Data privacy tool';
$string['cachedef_contextlevel'] = 'Context levels purpose and category';
$string['cancelrequest'] = 'Cancel request';
$string['cancelrequestconfirmation'] = 'Do you really want cancel this data request?';
$string['cancelrequestconfirmation'] = 'Do you want to cancel this data request?';
$string['cannotreset'] = 'Unable to reset this request. Only rejected requests can be reset.';
$string['categories'] = 'Categories';
$string['category'] = 'Category';
@@ -54,6 +54,7 @@ Feature: Data delete from the privacy API
And I should see "Awaiting approval" in the "Victim User 1" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And I follow "Approve request"
And I wait until "Approve request" "button" exists
And I press "Approve request"
And I should see "Approved" in the "Victim User 1" "table_row"
And I run all adhoc tasks
@@ -80,6 +81,7 @@ Feature: Data delete from the privacy API
And I navigate to "Users > Privacy and policies > Data requests" in site administration
And I open the action menu in "Victim User 1" "table_row"
And I follow "Approve request"
And I wait until "Approve request" "button" exists
And I press "Approve request"
And I log out
@@ -115,6 +117,7 @@ Feature: Data delete from the privacy API
And I navigate to "Users > Privacy and policies > Data requests" in site administration
And I open the action menu in "Victim User 1" "table_row"
And I follow "Approve request"
And I wait until "Approve request" "button" exists
And I press "Approve request"
And I log out
@@ -48,13 +48,15 @@ Feature: Data export from the privacy API
And I should see "Awaiting approval" in the "Victim User 1" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And I follow "Approve request"
And I wait until "Approve request" "button" exists
And I press "Approve request"
And I should see "Approved" in the "Victim User 1" "table_row"
And I run all adhoc tasks
And I reload the page
And I should see "Download ready" in the "Victim User 1" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And following "Download" should download between "1" and "200000" bytes
And following "Download" should download a file that:
| Contains file in zip | index.html |
And the following config values are set as admin:
| privacyrequestexpiry | 1 | tool_dataprivacy |
And I wait "1" seconds
@@ -89,7 +91,8 @@ Feature: Data export from the privacy API
And I reload the page
And I should see "Download ready" in the "Export all of my personal data" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And following "Download" should download between "1" and "200000" bytes
And following "Download" should download a file that:
| Contains file in zip | index.html |
And the following config values are set as admin:
| privacyrequestexpiry | 1 | tool_dataprivacy |
@@ -115,6 +118,7 @@ Feature: Data export from the privacy API
And I navigate to "Users > Privacy and policies > Data requests" in site administration
And I open the action menu in "Victim User 1" "table_row"
And I follow "Approve request"
And I wait until "Approve request" "button" exists
And I press "Approve request"
And I log out
@@ -126,7 +130,8 @@ Feature: Data export from the privacy API
And I reload the page
And I should see "Download ready" in the "Victim User 1" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And following "Download" should download between "1" and "200000" bytes
And following "Download" should download a file that:
| Contains file in zip | index.html |
And the following config values are set as admin:
| privacyrequestexpiry | 1 | tool_dataprivacy |
@@ -26,10 +26,11 @@ require_once('data_privacy_testcase.php');
* Expired data requests tests.
*
* @package tool_dataprivacy
* @covers \tool_dataprivacy\data_request
* @copyright 2018 Michael Hawkins
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class expired_data_requests_test extends data_privacy_testcase {
final class expired_data_requests_test extends data_privacy_testcase {
/**
* Test tearDown.
@@ -107,6 +108,52 @@ class expired_data_requests_test extends data_privacy_testcase {
$this->assertEquals(0, $DB->count_records('files', $fileconditions));
}
/**
* Test that data requests are not expired when expiration is disabled (set to zero)
*/
public function test_data_request_expiry_never(): void {
global $DB;
$this->resetAfterTest();
\core_privacy\local\request\writer::setup_real_writer_instance();
// Disable request expiry.
set_config('privacyrequestexpiry', 0, 'tool_dataprivacy');
// Create and approve data request.
$user = $this->getDataGenerator()->create_user();
$usercontext = \context_user::instance($user->id);
$this->setUser($user->id);
$datarequest = api::create_data_request($user->id, api::DATAREQUEST_TYPE_EXPORT);
$requestid = $datarequest->get('id');
$this->setAdminUser();
api::approve_data_request($requestid);
ob_start();
$this->runAdhocTasks('\tool_dataprivacy\task\process_data_request_task');
ob_end_clean();
// Run expiry deletion - should not affect test export.
$expiredrequests = data_request::get_expired_requests();
$this->assertEmpty($expiredrequests);
data_request::expire($expiredrequests);
// Confirm approved and exported.
$request = new data_request($requestid);
$this->assertEquals(api::DATAREQUEST_STATUS_DOWNLOAD_READY, $request->get('status'));
$fileconditions = [
'userid' => $user->id,
'component' => 'tool_dataprivacy',
'filearea' => 'export',
'itemid' => $requestid,
'contextid' => $usercontext->id,
];
$this->assertEquals(2, $DB->count_records('files', $fileconditions));
}
/**
* Test for \tool_dataprivacy\data_request::is_expired()
* Tests for the expected request status to protect from false positive/negative,
@@ -37,8 +37,8 @@ Feature: Delete custom licenses
| Licence version | ##1 March 2019## |
And I press "Save changes"
And I follow "Private files" in the user menu
And I upload "lib/editor/atto/tests/fixtures/moodle-logo.png" file to "Files" filemanager
And I click on "moodle-logo.png" "link"
And I upload "lib/tests/fixtures/gd-logo.png" file to "Files" filemanager
And I click on "gd-logo.png" "link"
And I set the field "Choose licence" to "Test licence"
And I press "Update"
And I press "Save changes"
@@ -14,6 +14,6 @@ Feature: In a report, admin can see logstore visibility changes
And I click on "Enable" "icon" in the "External database log" "table_row"
And I navigate to "Reports > Config changes" in site administration
Then the following should exist in the "reportbuilder-table" table:
| User | Plugin | Setting | New value | Original value |
| First name | Plugin | Setting | New value | Original value |
| Admin User | logstore_standard | tool_logstore_visibility | 0 | 1 |
| Admin User | logstore_database | tool_logstore_visibility | 1 | 0 |
File diff suppressed because one or more lines are too long
-2
View File
@@ -71,14 +71,12 @@ define(['jquery'], function($) {
return null;
};
// eslint-disable-line valid-jsdoc
/**
* Return the type of the module.
*
* @return {String}
* @method getType
*/
// eslint-enable-line valid-jsdoc
Rule.prototype.getType = function() {
throw new Error('Not implemented');
};
@@ -75,7 +75,7 @@ class manage_competency_frameworks_page implements renderable, templatable {
);
$this->navigation[] = $addpage;
$competenciesrepository = new single_button(
new moodle_url('https://archive.moodle.net/competencies'),
new moodle_url('https://moodle.net/search', ['q' => 'competency frameworks']),
get_string('competencyframeworksrepository', 'tool_lp'),
'get'
);
@@ -49,7 +49,7 @@
}
}}
<span>
<img height="12" src="{{profileimageurlsmall}}" alt="" role="presentation">
<img height="12" src="{{profileimageurlsmall}}" alt="">
<span>{{fullname}}</span>
{{#hasidentity}}
<span><small>{{identity}}</small></span>
@@ -49,7 +49,7 @@
<p>
<ul class="inline list-inline">
{{#coursemodules}}
<li class="list-inline-item"><a href="{{url}}"><img class="icon" src="{{iconurl}}"> {{name}} </a></li>
<li class="list-inline-item"><a href="{{url}}"><img class="icon" src="{{iconurl}}" alt=""> {{name}} </a></li>
{{/coursemodules}}
{{^coursemodules}}
<li class="list-inline-item"><span class="alert">{{#str}}noactivities, tool_lp{{/str}}</span></li>
@@ -50,7 +50,7 @@
}}
<span>
<a href="{{profileurl}}" title="{{#str}}viewprofile{{/str}}">
<img height="18" src="{{profileimageurlsmall}}" alt="" role="presentation">
<img height="18" src="{{profileimageurlsmall}}" alt="">
<span>{{fullname}}</span>
{{#hasidentity}}
<span><small>{{identity}}</small></span>
+10 -2
View File
@@ -369,6 +369,14 @@ class api {
$settings->forcetimezone = $CFG->forcetimezone;
}
if (empty($section) || $section === 'h5psettings') {
\core_h5p\local\library\autoloader::register();
$customcss = \core_h5p\file_storage::get_custom_styles();
if (!empty($customcss)) {
$settings->h5pcustomcssurl = $customcss['cssurl']->out() . '?ver=' . $customcss['cssversion'];
}
}
return $settings;
}
@@ -424,13 +432,13 @@ class api {
public static function get_qrlogin_key(stdClass $mobilesettings) {
global $USER;
// Delete previous keys.
delete_user_key('tool_mobile', $USER->id);
delete_user_key('tool_mobile/qrlogin', $USER->id);
// Create a new key.
$iprestriction = !empty($mobilesettings->qrsameipcheck) ? getremoteaddr(null) : null;
$qrkeyttl = !empty($mobilesettings->qrkeyttl) ? $mobilesettings->qrkeyttl : self::LOGIN_QR_KEY_TTL;
$validuntil = time() + $qrkeyttl;
return create_user_key('tool_mobile', $USER->id, null, $iprestriction, $validuntil);
return create_user_key('tool_mobile/qrlogin', $USER->id, null, $iprestriction, $validuntil);
}
/**
@@ -0,0 +1,45 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace tool_mobile;
use core\session\utility\cookie_helper;
use core\event\user_loggedin;
/**
* Event handler for tool_mobile.
*
* @package tool_mobile
* @copyright 2024 Juan Leyva
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class event_handler {
/**
* Allows the plugin to augment Set-Cookie headers when the user_loggedin event is fired as part of complete_user_login() calls.
*
* @param user_loggedin $event the event
* @return void
*/
public static function handle_user_loggedin(user_loggedin $event): void {
global $CFG;
// Set Partitioned and Secure attributes to the MoodleSession cookie if the user is using the Moodle app.
if (\core_useragent::is_moodle_app()) {
cookie_helper::add_attributes_to_cookie_response_header('MoodleSession'.$CFG->sessioncookie, ['Secure', 'Partitioned']);
}
}
}
+2 -2
View File
@@ -648,8 +648,8 @@ class external extends external_api {
api::check_autologin_prerequisites($params['userid']); // Checks https, avoid site admins using this...
// Validate and delete the key.
$key = validate_user_key($params['qrloginkey'], 'tool_mobile', null);
delete_user_key('tool_mobile', $params['userid']);
$key = validate_user_key($params['qrloginkey'], 'tool_mobile/qrlogin', null);
delete_user_key('tool_mobile/qrlogin', $params['userid']);
// Double check key belong to user.
if ($key->userid != $params['userid']) {
@@ -66,7 +66,7 @@ class provider implements
FROM {user_private_key} k
JOIN {user} u ON k.userid = u.id
JOIN {context} ctx ON ctx.instanceid = u.id AND ctx.contextlevel = :contextlevel
WHERE k.userid = :userid AND k.script = 'tool_mobile'";
WHERE k.userid = :userid AND (k.script = 'tool_mobile' OR k.script = 'tool_mobile/qrlogin')";
$params = ['userid' => $userid, 'contextlevel' => CONTEXT_USER];
$contextlist = new contextlist();
$contextlist->add_from_sql($sql, $params);
@@ -88,6 +88,7 @@ class provider implements
// Add users based on userkey.
\core_userkey\privacy\provider::get_user_contexts_with_script($userlist, $context, 'tool_mobile');
\core_userkey\privacy\provider::get_user_contexts_with_script($userlist, $context, 'tool_mobile/qrlogin');
}
/**
@@ -108,6 +109,7 @@ class provider implements
}
// Export associated userkeys.
\core_userkey\privacy\provider::export_userkeys($context, [], 'tool_mobile');
\core_userkey\privacy\provider::export_userkeys($context, [], 'tool_mobile/qrlogin');
}
/**
* Export all user preferences for the plugin.
@@ -138,6 +140,7 @@ class provider implements
$userid = $context->instanceid;
// Delete all the userkeys.
\core_userkey\privacy\provider::delete_userkeys('tool_mobile', $userid);
\core_userkey\privacy\provider::delete_userkeys('tool_mobile/qrlogin', $userid);
}
/**
* Delete all user data for the specified user, in the specified contexts.
@@ -158,6 +161,7 @@ class provider implements
$userid = $context->instanceid;
// Delete all the userkeys.
\core_userkey\privacy\provider::delete_userkeys('tool_mobile', $userid);
\core_userkey\privacy\provider::delete_userkeys('tool_mobile/qrlogin', $userid);
}
/**
@@ -178,5 +182,6 @@ class provider implements
// Delete all the userkeys.
\core_userkey\privacy\provider::delete_userkeys('tool_mobile', $userid);
\core_userkey\privacy\provider::delete_userkeys('tool_mobile/qrlogin', $userid);
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* tool_mobile plugin event handler definition.
*
* @package tool_mobile
* @category event
* @copyright 2024 Juan Leyva
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$observers = [
[
'eventname' => '\core\event\user_loggedin',
'callback' => '\tool_mobile\event_handler::handle_user_loggedin',
],
];
+8
View File
@@ -69,6 +69,14 @@ if (empty($service)) {
throw new moodle_exception('servicenotavailable', 'webservice');
}
// If the user is using the inapp (embedded) browser, we need to set the Secure and Partitioned attributes to the session cookie.
if (\core_useragent::is_moodle_app()) {
\core\session\utility\cookie_helper::add_attributes_to_cookie_response_header(
cookiename: "MoodleSession{$CFG->sessioncookie}",
attributes: ['Secure', 'Partitioned'],
);
}
require_login(0, false);
// Require an active user: not guest, not suspended.
+13
View File
@@ -265,3 +265,16 @@ function tool_mobile_pre_processor_message_send($procname, $data) {
$data->fullmessagehtml .= html_writer::tag('p', get_string('readingthisemailgettheapp', 'tool_mobile', $url->out()));
}
}
/**
* Callback to add headers before the HTTP headers are sent.
*
*/
function tool_mobile_before_http_headers() {
global $CFG;
// Set Partitioned and Secure attributes to the MoodleSession cookie if the user is using the Moodle app.
if (\core_useragent::is_moodle_app()) {
\core\session\utility\cookie_helper::add_attributes_to_cookie_response_header('MoodleSession'.$CFG->sessioncookie, ['Secure', 'Partitioned']);
}
}
@@ -260,6 +260,18 @@ class externallib_test extends externallib_advanced_testcase {
$this->assertCount(0, $result['warnings']);
$this->assertEquals($expected, $result['settings']);
// H5P custom CSS.
set_config('h5pcustomcss', '.debug { color: #fab; }', 'core_h5p');
\core_h5p\local\library\autoloader::register();
\core_h5p\file_storage::generate_custom_styles();
$result = external::get_config();
$result = external_api::clean_returnvalue(external::get_config_returns(), $result);
$customcss = \core_h5p\file_storage::get_custom_styles();
$expected[] = ['name' => 'h5pcustomcssurl', 'value' => $customcss['cssurl']->out() . '?ver=' . $customcss['cssversion']];
$this->assertCount(0, $result['warnings']);
$this->assertEquals($expected, $result['settings']);
// Change a value and retrieve filtering by section.
set_config('commentsperpage', 1);
$expected[10]['value'] = 1;
@@ -87,7 +87,8 @@ class provider_test extends \core_privacy\tests\provider_testcase {
$context1 = \context_user::instance($user1->id);
$context2 = \context_user::instance($user2->id);
$key1 = get_user_key('tool_mobile', $user1->id);
$key2 = get_user_key('tool_mobile', $user2->id);
$key2 = get_user_key('tool_mobile/qrlogin', $user1->id);
$key3 = get_user_key('tool_mobile', $user2->id);
// Ensure only user1 is found in context1.
$userlist = new \core_privacy\local\request\userlist($context1, $component);
@@ -175,12 +176,15 @@ class provider_test extends \core_privacy\tests\provider_testcase {
$context1 = \context_user::instance($user1->id);
$context2 = \context_user::instance($user2->id);
$keyvalue1 = get_user_key('tool_mobile', $user1->id);
$keyvalue2 = get_user_key('tool_mobile', $user2->id);
$keyvalue2 = get_user_key('tool_mobile/qrlogin', $user1->id);
$keyvalue3 = get_user_key('tool_mobile', $user2->id);
$key1 = $DB->get_record('user_private_key', ['value' => $keyvalue1]);
// Before deletion, we should have 2 user_private_keys.
// Before deletion, we should have 2 user_private_keys for tool_mobile and one for tool_mobile/qrlogin.
$count = $DB->count_records('user_private_key', ['script' => 'tool_mobile']);
$this->assertEquals(2, $count);
$count = $DB->count_records('user_private_key', ['script' => 'tool_mobile/qrlogin']);
$this->assertEquals(1, $count);
// Ensure deleting wrong user in the user context does nothing.
$approveduserids = [$user2->id];
@@ -198,6 +202,8 @@ class provider_test extends \core_privacy\tests\provider_testcase {
// Ensure only user1's data is deleted, user2's remains.
$count = $DB->count_records('user_private_key', ['script' => 'tool_mobile']);
$this->assertEquals(1, $count);
$count = $DB->count_records('user_private_key', ['script' => 'tool_mobile/qrlogin']);
$this->assertEquals(0, $count);
$params = ['script' => $component];
$userid = $DB->get_field_select('user_private_key', 'userid', 'script = :script', $params);
+1 -1
View File
@@ -23,7 +23,7 @@
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2023042400; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2023042401; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2023041800; // Requires this Moodle version.
$plugin->component = 'tool_mobile'; // Full name of the plugin (used for diagnostics).
$plugin->dependencies = array(
File diff suppressed because one or more lines are too long
@@ -121,7 +121,6 @@ define(['tool_moodlenet/validator',
});
// Trigger the transition between 'pages'.
carousel.carousel(2);
// eslint-disable-next-line max-len
modal.setFooter(Templates.render('tool_moodlenet/chooser_footer_close_mnet', {}));
};
+1 -1
View File
@@ -63,7 +63,7 @@ if ($cancel) {
}
redirect($url);
} else if ($continue) {
confirm_sesskey();
require_sesskey();
// Handle backups.
if (strtolower($importinfo->get_resource()->get_extension()) == 'mbz') {
+1 -1
View File
@@ -81,7 +81,7 @@ switch ($config->type) {
}
if ($import && $module) {
confirm_sesskey();
require_sesskey();
$handlerinfo = $handlerregistry->get_resource_handler_for_mod_and_strategy($importinfo->get_resource(), $module, $strategy);
if (is_null($handlerinfo)) {
@@ -170,6 +170,7 @@ Feature: Viewing acceptances reports and accepting on behalf of other users
And I navigate to "Users > Privacy and policies > Manage policies" in site administration
And I click on "Actions" "link_or_button" in the "This privacy policy" "table_row"
And I click on "Set status to \"Active\"" "link" in the "This privacy policy" "table_row"
And I wait until "Activate" "button" exists
And I press "Activate"
And I log out
When I log in as "manager"
@@ -260,6 +261,7 @@ Feature: Viewing acceptances reports and accepting on behalf of other users
And I navigate to "Users > Privacy and policies > Manage policies" in site administration
And I click on "Actions" "link_or_button" in the "This privacy policy" "table_row"
And I click on "Set status to \"Active\"" "link" in the "This privacy policy" "table_row"
And I wait until "Activate" "button" exists
And I press "Activate"
And I log out
When I log in as "manager"
@@ -62,8 +62,8 @@ Feature: Manage scheduled tasks
And I press "Save changes"
Then I should see "Changes saved"
And the following should not exist in the "admintable" table:
| Name | Component | Minute | Hour | Day | Day of week | Month |
| Log table cleanup | Standard log | */5 | 1 | 2 | 4 | 3 |
| Name | Minute | Hour | Day | Day of week | Month |
| Log table cleanup | */5 | 1 | 2 | 4 | 3 |
And I should see "Log table cleanup" in the "tr.table-primary" "css_element"
Scenario: Disabled plugin's tasks are labelled as disabled too
+11
View File
@@ -688,6 +688,17 @@ class process {
break;
case UU_USER_ADD_UPDATE:
if ($this->get_match_on_email()) {
if ($usersbyname = $DB->get_records('user', ['username' => $user->username])) {
foreach ($usersbyname as $userbyname) {
if (strtolower($userbyname->email) != strtolower($user->email)) {
$this->usersskipped++;
$this->upt->track('status', get_string('usernotaddedusernameexists', 'error'), 'warning');
$skip = true;
}
}
}
}
break;
case UU_USER_UPDATE:
@@ -50,7 +50,7 @@ The example text file may also be used for testing, as you are able to preview u
$string['infoprefix'] = 'Info:';
$string['invalidupdatetype'] = 'This option cannot be selected with the chosen upload type.';
$string['invaliduserdata'] = 'Invalid data detected for user {$a} and it has been automatically cleaned.';
$string['invaliduserdatavalues'] = 'Invalid data detected for user \'{$a->username}\' ({$a->values}), which has been automatically cleaned.';
$string['invaliduserdatavalues'] = 'Incorrect data ({$a->values}) found for user {$a->username}. This data has been corrected or deleted.';
$string['invalidtheme'] = 'Theme "{$a}" is not installed and will be ignored.';
$string['linex'] = 'Line {$a}';
$string['matchemail'] = 'Match on email address';
@@ -296,3 +296,25 @@ Feature: Upload users
And I navigate to "Users > Accounts > Browse list of users" in site administration
And I should see "Bilbo Baggins"
And I should not see "Frodo Baggins"
@javascript
Scenario: Create a new user when matching them on email where where the username already exists
Given the following "users" exist:
| username | firstname | lastname | email |
| bilbob | Samwise | Gamgee | samwise@example.com |
| frodob | Frodeo | Baspins | frodo@example.com |
And I log in as "admin"
And I navigate to "Users > Accounts > Upload users" in site administration
When I upload "lib/tests/fixtures/upload_users_email_matching.csv" file to "File" filemanager
And I press "Upload users"
Then I should see "Upload users preview"
And I set the following fields to these values:
| Upload type | Add new and update existing users |
| Existing user details | Override with file |
| Match on email address | Yes |
And I press "Upload users"
And I should see "User not added - username already exists under a different email"
And I press "Continue"
And I navigate to "Users > Accounts > Browse list of users" in site administration
And I should see "Samwise Gamgee"
And I should see "Frodo Baggins"
@@ -202,8 +202,8 @@ EOF;
// We should get the debugging from the user class itself, as well as warning in the output regarding the same.
$this->assertDebuggingCalled('The property \'country\' has invalid data and has been cleaned.');
$this->assertStringContainsString('Invalid data detected for user \'student1\' (country), ' .
'which has been automatically cleaned.', $output);
$this->assertStringContainsString('Incorrect data (country) found for user student1. ' .
'This data has been corrected or deleted.', $output);
}
/**
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+33 -11
View File
@@ -36,6 +36,7 @@ import {dispatchEvent} from 'core/event_dispatcher';
import {eventTypes} from './events';
import {get_string as getString} from 'core/str';
import {prefetchStrings} from 'core/prefetch';
import PendingPromise from 'core/pending';
/**
* The minimum spacing for tour step to display.
@@ -485,14 +486,22 @@ const Tour = class {
return this.endTour();
}
const pendingPromise = new PendingPromise(`tool_usertours/tour:_gotoStep-${stepConfig.stepNumber}`);
if (typeof stepConfig.delay !== 'undefined' && stepConfig.delay && !stepConfig.delayed) {
stepConfig.delayed = true;
window.setTimeout(this._gotoStep.bind(this), stepConfig.delay, stepConfig, direction);
window.setTimeout(function(stepConfig, direction) {
this._gotoStep(stepConfig, direction);
pendingPromise.resolve();
}, stepConfig.delay, stepConfig, direction);
return this;
} else if (!stepConfig.orphan && !this.isStepActuallyVisible(stepConfig)) {
let fn = direction == -1 ? 'getPreviousStepNumber' : 'getNextStepNumber';
return this.gotoStep(this[fn](stepConfig.stepNumber), direction);
const fn = direction == -1 ? 'getPreviousStepNumber' : 'getNextStepNumber';
this.gotoStep(this[fn](stepConfig.stepNumber), direction);
pendingPromise.resolve();
return this;
}
this.hide();
@@ -503,6 +512,7 @@ const Tour = class {
this.dispatchEvent(eventTypes.stepRendered, {stepConfig});
}
pendingPromise.resolve();
return this;
}
@@ -820,12 +830,14 @@ const Tour = class {
left: 0,
});
const pendingPromise = new PendingPromise(`tool_usertours/tour:addStepToPage-${stepConfig.stepNumber}`);
animationTarget
.animate({
scrollTop: this.calculateScrollTop(stepConfig),
}).promise().then(function() {
this.positionStep(stepConfig);
this.revealStep(stepConfig);
pendingPromise.resolve();
return;
}.bind(this))
.catch(function() {
@@ -897,6 +909,7 @@ const Tour = class {
*/
revealStep(stepConfig) {
// Fade the step in.
const pendingPromise = new PendingPromise(`tool_usertours/tour:revealStep-${stepConfig.stepNumber}`);
this.currentStepNode.fadeIn('', $.proxy(function() {
// Announce via ARIA.
this.announceStep(stepConfig);
@@ -910,6 +923,7 @@ const Tour = class {
if (this.currentStepNode) {
this.currentStepNode.focus();
}
pendingPromise.resolve();
}, this), 100);
}, this));
@@ -1157,6 +1171,7 @@ const Tour = class {
return this;
}
const pendingPromise = new PendingPromise('tool_usertours/tour:hide');
if (this.currentStepNode && this.currentStepNode.length) {
this.currentStepNode.hide();
if (this.currentStepPopper) {
@@ -1191,17 +1206,22 @@ const Tour = class {
this.currentStepConfig = null;
}
let fadeTime = 0;
if (transition) {
fadeTime = 400;
}
// Remove the backdrop features.
$('[data-flexitour="step-background"]').remove();
$('[data-flexitour="step-backdrop"]').removeAttr('data-flexitour');
$('[data-flexitour="backdrop"]').fadeOut(fadeTime, function() {
$(this).remove();
});
const backdrop = $('[data-flexitour="backdrop"]');
if (backdrop.length) {
if (transition) {
const backdropRemovalPromise = new PendingPromise('tool_usertours/tour:hide:backdrop');
backdrop.fadeOut(400, function() {
$(this).remove();
backdropRemovalPromise.resolve();
});
} else {
backdrop.remove();
}
}
// Remove aria-describedby and tabindex attributes.
if (this.currentStepNode && this.currentStepNode.length) {
@@ -1222,6 +1242,8 @@ const Tour = class {
this.currentStepNode = null;
this.currentStepPopper = null;
pendingPromise.resolve();
return this;
}
+1 -1
View File
@@ -283,7 +283,7 @@ class manager {
'title' => get_string('importtour', 'tool_usertours'),
],
(object) [
'link' => new \moodle_url('https://archive.moodle.net/tours'),
'link' => new \moodle_url('https://moodle.net/search', ['q' => 'user tours']),
'linkproperties' => [
'target' => '_blank',
],
@@ -25,6 +25,7 @@ Feature: Apply content type to a tour
Then "Content type" "select" should exist
And the "Content type" select box should contain "Language string ID"
And the "Content type" select box should contain "Manual"
And I change window size to "large"
And I select "Language string ID" from the "Content type" singleselect
And I should see " Language string ID"
And "#fgroup_id_contenthtmlgrp" "css_element" should not be visible
@@ -38,6 +39,7 @@ Feature: Apply content type to a tour
And I click on "View" "link" in the "My first tour" "table_row"
And I click on "New step" "link"
And I set the field "Title" to "tour_activityinfo_course_teacher_title,tool_usertours"
And I change window size to "large"
And I select "Language string ID" from the "Content type" singleselect
And I set the field "Language string ID" to "tour_activityinfo_course_teacher_content_abc,tool_usertours"
When I press "Save changes"
@@ -91,12 +91,12 @@ class edit_field_save extends XMLDBAction {
$comment = trim($comment);
$type = required_param('type', PARAM_INT);
$length = strtolower(optional_param('length', NULL, PARAM_ALPHANUM));
$length = optional_param('length', null, PARAM_INT);
$decimals = optional_param('decimals', NULL, PARAM_INT);
$notnull = optional_param('notnull', false, PARAM_BOOL);
$sequence = optional_param('sequence', false, PARAM_BOOL);
$default = optional_param('default', NULL, PARAM_PATH);
$default = trim($default);
$default = is_null($default) ? $default : trim($default);
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
@@ -36,6 +36,11 @@ class new_table_from_mysql extends XMLDBAction {
function init() {
parent::init();
global $DB;
if ($DB->get_dbfamily() !== 'mysql') {
throw new moodle_exception('DB family not supported');
}
// Set own custom attributes
// Get needed strings
@@ -55,8 +60,6 @@ class new_table_from_mysql extends XMLDBAction {
function invoke() {
parent::invoke();
$result = true;
// Set own core attributes
$this->does_generate = ACTION_GENERATE_HTML;
@@ -125,11 +128,15 @@ class new_table_from_mysql extends XMLDBAction {
// If table, retrofit information and, if everything works,
// go to the table edit action
} else {
// Get some params (table is mandatory here)
$tableparam = required_param('table', PARAM_CLEAN);
$afterparam = required_param('after', PARAM_CLEAN);
// Get some params (table is mandatory here).
$tableparam = required_param('table', PARAM_ALPHANUMEXT);
$afterparam = required_param('after', PARAM_ALPHANUMEXT);
// Create one new xmldb_table
if (empty($tableparam) || empty($afterparam)) {
throw new moodle_exception('Invalid param value detected.');
}
// Create one new xmldb_table.
$table = new xmldb_table(strtolower(trim($tableparam)));
$table->setComment($table->getName() . ' table retrofitted from MySQL');
// Get fields info from ADODb
@@ -147,7 +154,6 @@ class new_table_from_mysql extends XMLDBAction {
// Get PK, UK and indexes info from ADODb
$dbindexes = $DB->get_indexes($tableparam);
if ($dbindexes) {
$lastkey = NULL; //To temp store the last key processed
foreach ($dbindexes as $indexname => $dbindex) {
// Add the indexname to the array
$dbindex['name'] = $indexname;
@@ -156,9 +162,6 @@ class new_table_from_mysql extends XMLDBAction {
$key = new xmldb_key(strtolower($dbindex['name']));
// Set key with info retrofitted
$key->setFromADOKey($dbindex);
// Set default comment to PKs
if ($key->getType() == XMLDB_KEY_PRIMARY) {
}
// Add key to the table
$table->addKey($key);
@@ -172,18 +175,17 @@ class new_table_from_mysql extends XMLDBAction {
}
}
}
// Finally, add the whole retroffited table to the structure
// in the place specified
// Finally, add the whole retrofitted table to the structure in the place specified.
$structure->addTable($table, $afterparam);
}
// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
if ($this->getPostAction()) {
return $this->launch($this->getPostAction());
}
// Return ok if arrived here
return $result;
return true;
}
}
+3 -1
View File
@@ -114,6 +114,7 @@ Feature: Manage analytics models
And I should see "Read actions amount"
And I click on "Select Student 6 for bulk action" "checkbox" in the "Student 6" "table_row"
And I click on "Accept" "button"
And I wait until "Confirm" "button" exists
And I click on "Confirm" "button" in the "Accept" "dialogue"
And I click on "View prediction details" "icon" in the "Student 5" "table_row"
And I click on "Select Student 5 for bulk action" "checkbox" in the "Student 5" "table_row"
@@ -145,7 +146,8 @@ Feature: Manage analytics models
When I open the action menu in "Students at risk of not meeting the course completion conditions" "table_row"
And I choose "Export" in the open action menu
And I click on "Actions" "link" in the "Students at risk of not meeting the course completion conditions" "table_row"
And following "Export" should download between "100" and "500" bytes
And following "Export" should download a file that:
| Contains file in zip | model-config.json |
Scenario: Check invalid site elements
When I open the action menu in "Students at risk of not meeting the course completion conditions" "table_row"
@@ -14,31 +14,29 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for activities completed by classification.
*
* @package core_analytics
* @copyright 2017 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_analytics;
defined('MOODLE_INTERNAL') || die();
use advanced_testcase;
use ReflectionClass;
use ReflectionMethod;
use stdClass;
/**
* Unit tests for activities completed by classification.
*
* @package core_analytics
* @covers \core_analytics\local\indicator\community_of_inquiry_activity
* @copyright 2017 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class community_of_inquiry_activities_completed_by_testcase extends advanced_testcase {
final class community_of_inquiry_activities_completed_by_test extends advanced_testcase {
/**
* availability_levels
*
* @return array
*/
public function availability_levels() {
public static function availability_levels(): array {
return array(
'activity' => array('activity'),
'section' => array('section'),
@@ -148,7 +146,7 @@ class community_of_inquiry_activities_completed_by_testcase extends advanced_tes
$second = $startdate + WEEKSECS;
$third = $startdate + (WEEKSECS * 2);
$forth = $startdate + (WEEKSECS * 3);
$this->assertCount(1, $method->invoke($indicator, $first, $first + WEEKSECS, $stu1));
$this->assertCount(2, $method->invoke($indicator, $first, $first + WEEKSECS, $stu1));
$this->assertCount(1, $method->invoke($indicator, $second, $second + WEEKSECS, $stu1));
$this->assertCount(0, $method->invoke($indicator, $third, $third + WEEKSECS, $stu1));
$this->assertCount(2, $method->invoke($indicator, $forth, $forth + WEEKSECS, $stu1));
+1 -1
View File
@@ -115,7 +115,7 @@ class auth_plugin_lti extends \auth_plugin_base {
if (isloggedin()) {
// If a different user is currently logged in, authenticate the linked user instead.
global $USER;
if ((int) $USER->id !== $user->id) {
if ($USER->id !== $user->id) {
complete_user_login($user);
}
// If the linked user is already logged in, skip the call to complete_user_login() because this affects deep linking
@@ -0,0 +1,48 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace auth_lti\local\ltiadvantage\event;
use auth_lti\local\ltiadvantage\utility\cookie_helper;
use core\event\user_loggedin;
/**
* Event handler for auth_lti.
*
* @package auth_lti
* @copyright 2024 Jake Dallimore <jrhdallimore@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class event_handler {
/**
* Allows the plugin to augment Set-Cookie headers when the user_loggedin event is fired as part of complete_user_login() calls.
*
* @param user_loggedin $event the event
* @return void
*/
public static function handle_user_loggedin(user_loggedin $event): void {
// The event data isn't important here. The intent of this listener is to ensure that the MoodleSession cookie is set up
// properly during LTI launches + login. This means two things:
// i) it's set with SameSite=None; Secure; where possible (since OIDC needs HTTPS this will almost always be possible).
// ii) it set with the 'Partitioned' attribute, when required.
// The former ensures cross-site cookies are sent for embedded launches. The latter is an opt-in flag needed to use Chrome's
// partitioning mechanism, CHIPS.
if (cookie_helper::cookies_supported()) {
cookie_helper::setup_session_cookie();
}
}
}
@@ -0,0 +1,173 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace auth_lti\local\ltiadvantage\utility;
use core\session\utility\cookie_helper as core_cookie_helper;
/**
* Helper class providing utils dealing with cookies in LTI, particularly 3rd party cookies.
*
* @package auth_lti
* @copyright 2024 Jake Dallimore <jrhdallimore@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
final class cookie_helper {
/** @var int Cookies are not supported. */
public const COOKIE_METHOD_NOT_SUPPORTED = 0;
/** @var int Cookies are supported without explicit partitioning. */
public const COOKIE_METHOD_NO_PARTITIONING = 1;
/** @var int Cookies are supported via explicit partitioning. */
public const COOKIE_METHOD_EXPLICIT_PARTITIONING = 2;
/**
* Check whether cookies can be used with the current user agent and, if so, via what method they are set.
*
* Currently, this tries 2 modes of setting a test cookie:
* 1. Setting a SameSite=None, Secure cookie. This will work in any first party context, and in 3rd party contexts for
* any browsers supporting automatic partitioning of 3rd party cookies (E.g. Firefox, Brave).
* 2. If 1 fails, setting a cookie with the Chrome 'Partitioned' attribute included, opting that cookie into CHIPS. This will
* work for Chrome.
*
* Upon completion of the cookie check, the check sets a SESSION flag indicating the method used to set the cookie, and upgrades
* the session cookie ('MoodleSession') using the respective method. This ensure the session cookie will continue to be sent.
*
* Then, the following methods can be used by client code to query whether the UA supports cookies, and how:
* @see self::cookies_supported() - whether it could be set at all.
* @see self::get_cookies_supported_mode() - if a cookie could be set, what mode was used to set it.
*
* This permits client code to make sure it's setting its cookies appropriately (via the advertised method), and allows it to
* present notices - such as in the case where a given UA is found to be lacking the requisite cookie support.
* E.g.
* cookie_helper::do_cookie_check($mypageurl);
* if (!cookie_helper::cookies_supported()) {
* // Print a notice stating that cookie support is required.
* }
* // Elsewhere in other client code...
* if (cookie_helper::get_cookies_supported_mode() === cookie_helper::COOKIE_METHOD_EXPLICIT_PARTITIONING) {
* // Set a cookie, making sure to use the helper to also opt-in to partitioning.
* setcookie('myauthcookie', 'myauthcookievalue', ['samesite' => 'None', 'secure' => true]);
* cookie_helper::add_partitioning_to_cookie('myauthcookie');
* }
*
* @param \moodle_url $pageurl the URL of the page making the check, used to redirect back to after setting test cookies.
* @return void
*/
public static function do_cookie_check(\moodle_url $pageurl): void {
global $_COOKIE, $SESSION, $CFG;
$cookiecheck1 = optional_param('cookiecheck1', null, PARAM_INT);
$cookiecheck2 = optional_param('cookiecheck2', null, PARAM_INT);
if (empty($cookiecheck1)) {
// Start the cookie check. Set two test cookies - one samesite none, and one partitioned - and redirect.
// Set cookiecheck to show the check has started.
self::set_test_cookie('cookiecheck1', self::COOKIE_METHOD_NO_PARTITIONING);
self::set_test_cookie('cookiecheck2', self::COOKIE_METHOD_EXPLICIT_PARTITIONING, true);
$pageurl->params([
'cookiecheck1' => self::COOKIE_METHOD_NO_PARTITIONING,
'cookiecheck2' => self::COOKIE_METHOD_EXPLICIT_PARTITIONING,
]);
// LTI needs to guarantee the 'SameSite=None', 'Secure' (and sometimes 'Partitioned') attributes are set on the
// MoodleSession cookie. This is done via manipulation of the outgoing headers after the cookie check redirect. To
// guarantee these outgoing Set-Cookie headers will be created after the redirect, expire the current cookie.
core_cookie_helper::expire_moodlesession();
redirect($pageurl);
} else {
// Have already started a cookie check, so check the result.
$cookie1received = isset($_COOKIE['cookiecheck1']) && $_COOKIE['cookiecheck1'] == $cookiecheck1;
$cookie2received = isset($_COOKIE['cookiecheck2']) && $_COOKIE['cookiecheck2'] == $cookiecheck2;
if ($cookie1received || $cookie2received) {
// The test cookie could be set and received.
// Set a session flag storing the method used to set it, and make sure the session cookie uses this method.
$cookiemethod = $cookie1received ? self::COOKIE_METHOD_NO_PARTITIONING : self::COOKIE_METHOD_EXPLICIT_PARTITIONING;
$SESSION->auth_lti_cookie_method = $cookiemethod;
self::setup_session_cookie();
}
}
}
/**
* If a cookie check has been made, returns whether cookies could be set or not.
*
* @return bool whether cookies are supported or not.
*/
public static function cookies_supported(): bool {
return self::get_cookies_supported_method() !== self::COOKIE_METHOD_NOT_SUPPORTED;
}
/**
* If a cookie check has been made, gets the method used to set a cookie, or self::COOKIE_METHOD_NOT_SUPPORTED if not supported.
*
* For cookie methods:
* @see self::COOKIE_METHOD_NOT_SUPPORTED
* @see self::COOKIE_METHOD_NO_PARTITIONING
* @see self::COOKIE_METHOD_EXPLICIT_PARTITIONING
*
* @return int the constant representing the method by which the cookie was set, or not.
*/
public static function get_cookies_supported_method(): int {
global $SESSION;
return $SESSION->auth_lti_cookie_method ?? self::COOKIE_METHOD_NOT_SUPPORTED;
}
/**
* Sets up the session cookie according to the method used in the cookie check, and with SameSite=None; Secure attributes.
*
* @return void
*/
public static function setup_session_cookie(): void {
global $CFG;
require_once($CFG->libdir . '/sessionlib.php');
if (is_moodle_cookie_secure()) {
$atts = ['SameSite=None', 'Secure'];
if (self::get_cookies_supported_method() == self::COOKIE_METHOD_EXPLICIT_PARTITIONING) {
$atts[] = 'Partitioned';
}
core_cookie_helper::add_attributes_to_cookie_response_header('MoodleSession' . $CFG->sessioncookie, $atts);
}
}
/**
* Set a test cookie, using SameSite=None; Secure; attributes if possible, and with or without partitioning opt-in.
*
* @param string $name cookie name
* @param string $value cookie value
* @param bool $partitioned whether to try to add partitioning opt-in, which requires secure cookies (https sites).
* @return void
*/
private static function set_test_cookie(string $name, string $value, bool $partitioned = false): void {
global $CFG;
require_once($CFG->libdir . '/sessionlib.php');
$atts = ['expires' => time() + 30];
if (is_moodle_cookie_secure()) {
$atts['samesite'] = 'none';
$atts['secure'] = true;
}
setcookie($name, $value, $atts);
if (is_moodle_cookie_secure() && $partitioned) {
core_cookie_helper::add_attributes_to_cookie_response_header($name, ['Partitioned']);
}
}
}
+5 -6
View File
@@ -33,33 +33,32 @@ class renderer extends \plugin_renderer_base {
* @return string the html.
*/
public function render_account_binding_options_page(int $provisioningmode): string {
$formaction = new \moodle_url('/auth/lti/login.php');
$notification = new notification(get_string('firstlaunchnotice', 'auth_lti'), \core\notification::INFO, false);
$noauthnotice = new notification(get_string('firstlaunchnoauthnotice', 'auth_lti', get_docs_url('Publish_as_LTI_tool')),
\core\notification::WARNING, false);
$cancreateaccounts = !get_config('moodle', 'authpreventaccountcreation');
if ($provisioningmode == \auth_plugin_lti::PROVISIONING_MODE_PROMPT_EXISTING_ONLY) {
$cancreateaccounts = false;
}
$accountinfo = ['isloggedin' => isloggedin()];
$accountinfo = [];
if (isloggedin()) {
global $USER;
$accountinfo = array_merge($accountinfo, [
$accountinfo = [
'firstname' => $USER->firstname,
'lastname' => $USER->lastname,
'email' => $USER->email,
'picturehtml' => $this->output->user_picture($USER, ['size' => 35, 'class' => 'round']),
]);
];
}
$context = [
'isloggedin' => isloggedin(),
'info' => $notification->export_for_template($this),
'formaction' => $formaction->out(),
'sesskey' => sesskey(),
'accountinfo' => $accountinfo,
'cancreateaccounts' => $cancreateaccounts,
'noauthnotice' => $noauthnotice->export_for_template($this)
];
return parent::render_from_template('auth_lti/local/ltiadvantage/login', $context);
}
+33
View File
@@ -0,0 +1,33 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* LTI Auth plugin event handler definition.
*
* @package auth_lti
* @category event
* @copyright 2024 Jake Dallimore <jrhdallimore@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$observers = [
[
'eventname' => '\core\event\user_loggedin',
'callback' => '\auth_lti\local\ltiadvantage\event\event_handler::handle_user_loggedin',
],
];
+1 -1
View File
@@ -35,7 +35,7 @@ $string['firstlaunchnoauthnotice'] = 'To link your existing account you must be
$string['getstartedwithnewaccount'] = 'Get started with a new account';
$string['haveexistingaccount'] = 'I have an existing account';
$string['linkthisaccount'] = 'Link this account';
$string['mustbeloggedin'] = 'You need to be logged in to your existing account';
$string['mustbeloggedin'] = 'Log in to link your existing account.';
$string['pluginname'] = 'LTI';
$string['privacy:metadata:auth_lti'] = 'LTI authentication';
$string['privacy:metadata:auth_lti:authsubsystem'] = 'This plugin is connected to the authentication subsystem.';
@@ -32,7 +32,6 @@
* info - a notification describing the first launch options
* cancreateaccounts - whether or not the user is allowed to create auth_lti accounts
* accountinfo - information about the user, importantly whether they are logged in or not.
* noauthnotice - a notification telling the user they must be authenticated to link accounts. Only relevant when not logged in.
Example context (json):
{
@@ -46,19 +45,12 @@
"issuccess": true
},
"cancreateaccounts": true,
"isloggedin": true,
"accountinfo": {
"isloggedin": true,
"firstname": "John",
"lastname": "Smith",
"email": "john@example.com",
"picturehtml": "<img src=\"http://site.example.com/pluginfile.php/5/user/icon/boost/f2?rev=99\" class=\"round\" alt=\"\" width=\"35\" height=\"35\">"
},
"noauthnotice": {
"message": "To link your existing account you must be logged in to the site...",
"extraclasses": "",
"announce": false,
"closebutton": false,
"iswarning": true
}
}
}}
@@ -79,8 +71,8 @@
<div class="card-body text-center d-flex flex-column">
<i class="fa fa-user-circle-o fa-2x link"></i>
<h4 class="card-title">{{#str}} useexistingaccount, auth_lti {{/str}}</h4>
{{#accountinfo}}
{{#isloggedin}}
{{#accountinfo}}
<p class="card-text mt-2">
<span class="text-muted">
{{#str}} currentlyloggedinas, auth_lti {{/str}}
@@ -90,14 +82,12 @@
{{firstname}} {{lastname}} ({{email}})
</p>
<input type="submit" class="btn btn-primary mt-auto" name="existing_account" value="{{#str}} linkthisaccount, auth_lti {{/str}}">
{{/accountinfo}}
{{/isloggedin}}
{{^isloggedin}}
<p class="card-text text-muted">{{#str}} mustbeloggedin, auth_lti {{/str}}</p>
{{#noauthnotice}}
{{> core/notification}}
{{/noauthnotice}}
<input type="submit" class="btn btn-primary mt-auto" name="existing_account" value="{{#str}} login, moodle {{/str}}">
{{/isloggedin}}
{{/accountinfo}}
</div>
</div>
</div>
+1 -1
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2023042400; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2023042401; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2023041800; // Requires this Moodle version.
$plugin->component = 'auth_lti'; // Full name of the plugin (used for diagnostics).
+9 -4
View File
@@ -345,7 +345,7 @@ class api {
}
/**
* Delete linked login
* Delete a users own linked login
*
* Requires auth/oauth2:managelinkedlogins capability at the user context.
*
@@ -353,14 +353,19 @@ class api {
* @return boolean
*/
public static function delete_linked_login($linkedloginid) {
$login = new linked_login($linkedloginid);
$userid = $login->get('userid');
global $USER;
if (\core\session\manager::is_loggedinas()) {
throw new moodle_exception('notwhileloggedinas', 'auth_oauth2');
}
$context = context_user::instance($userid);
$login = linked_login::get_record([
'id' => $linkedloginid,
'userid' => $USER->id,
'confirmtoken' => '',
], MUST_EXIST);
$context = context_user::instance($login->get('userid'));
require_capability('auth/oauth2:managelinkedlogins', $context);
$login->delete();
+25
View File
@@ -137,6 +137,7 @@ class api_test extends \advanced_testcase {
$issuer = \core\oauth2\api::create_standard_issuer('google');
$user = $this->getDataGenerator()->create_user();
$this->setUser($user);
$info = [];
$info['username'] = 'banana';
@@ -169,6 +170,30 @@ class api_test extends \advanced_testcase {
$this->assertEquals($newuser->id, $match->get('userid'));
}
/**
* Test that we cannot deleted a linked login for another user
*/
public function test_delete_linked_login_other_user(): void {
$this->resetAfterTest();
$this->setAdminUser();
$issuer = \core\oauth2\api::create_standard_issuer('google');
$user = $this->getDataGenerator()->create_user();
api::link_login([
'username' => 'banana',
'email' => 'banana@example.com',
], $issuer, $user->id);
/** @var linked_login $linkedlogin */
$linkedlogin = api::get_linked_logins($user->id)[0];
// We are logged in as a different user, so cannot delete this.
$this->expectException(\dml_missing_record_exception::class);
api::delete_linked_login($linkedlogin->get('id'));
}
/**
* Test that is_enabled correctly identifies when the plugin is enabled.
*/
+28
View File
@@ -49,6 +49,9 @@ abstract class info {
/** @var tree Availability configuration, decoded from JSON; null if unset */
protected $availabilitytree;
/** @var array The groups the current user belongs to. */
protected $groups;
/** @var array|null Array of information about current restore if any */
protected static $restoreinfo = null;
@@ -65,6 +68,7 @@ abstract class info {
$this->course = $course;
$this->visible = (bool)$visible;
$this->availability = $availability;
$this->groups = null;
}
/**
@@ -800,4 +804,28 @@ abstract class info {
}
return false;
}
/**
* Returns groups that the current user belongs to on the course. Note: If not already
* available, this may make a database query.
*
* This will include groups the user is not allowed to see themselves, so check visibility
* before displaying groups to the user.
*
* @param int $groupingid Grouping ID or 0 (default) for all groups
* @return int[] Array of int (group id) => int (same group id again); empty array if none
*/
public function get_groups(int $groupingid = 0): array {
global $USER;
if (is_null($this->groups)) {
$allgroups = groups_get_user_groups($this->course->id, $USER->id, true);
$this->groups = $allgroups;
} else {
$allgroups = $this->groups;
}
if (!isset($allgroups[$groupingid])) {
return [];
}
return $allgroups[$groupingid];
}
}
@@ -71,7 +71,7 @@ class condition extends \core_availability\condition {
$allow = true;
if (!has_capability('moodle/site:accessallgroups', $context, $userid)) {
// Get all groups the user belongs to.
$groups = $info->get_modinfo()->get_groups();
$groups = $info->get_groups();
if ($this->groupid) {
$allow = in_array($this->groupid, $groups);
} else {
@@ -108,3 +108,49 @@ Feature: availability_group
When I am on the "C1" "Course" page logged in as "student1"
Then I should see "Not available unless: You belong to G-One"
And I should not see "G-Un"
@javascript
Scenario: Condition using a hidden group
Given the following "groups" exist:
| name | course | idnumber | visibility |
| Hidden Group | C1 | GA | 3 |
And I log in as "teacher1"
And I add a page activity to course "Course 1" section "1"
And I expand all fieldsets
# Page P1 any group.
And I am on the "P1" "page activity editing" page
And I expand all fieldsets
And I click on "Add restriction..." "button"
And "Group" "button" should exist in the "Add restriction..." "dialogue"
And I click on "Group" "button" in the "Add restriction..." "dialogue"
And I set the field "Group" to "(Any group)"
And I click on ".availability-item .availability-eye img" "css_element"
And I click on "Save and return to course" "button"
# Page P2 with hidden group.
And I am on the "P2" "page activity editing" page
And I expand all fieldsets
And I click on "Add restriction..." "button"
And I click on "Group" "button" in the "Add restriction..." "dialogue"
And I set the field "Group" to "Hidden Group"
And I click on "Save and return to course" "button"
# Log back in as student.
When I am on the "Course 1" "course" page logged in as "student1"
# No pages should appear yet.
Then I should not see "P1" in the "region-main" "region"
And I should not see "P2" in the "region-main" "region"
And I should not see "Hidden Group"
# Add to groups and log out/in again.
And the following "group members" exist:
| user | group |
| student1 | GA |
And I am on "Course 1" course homepage
# P1 (any groups) and P2 should show. The user should not see the hidden group mentioned anywhere.
And I should see "P1" in the "region-main" "region"
And I should see "P2" in the "region-main" "region"
And I should not see "Hidden Group"
@@ -49,6 +49,7 @@ class condition_test extends \advanced_testcase {
$course = $generator->create_course();
$user = $generator->create_user();
$generator->enrol_user($user->id, $course->id);
$this->setUser($user);
$info = new \core_availability\mock_info($course, $user->id);
// Make 2 test groups, one in a grouping and one not.
@@ -70,7 +71,7 @@ class condition_test extends \advanced_testcase {
// Add user to groups and refresh cache.
groups_add_member($group1, $user);
groups_add_member($group2, $user);
get_fast_modinfo($course->id, 0, true);
$info = new \core_availability\mock_info($course, $user->id);
// Recheck.
$this->assertTrue($cond->is_available(false, $info, true, $user->id));
+1 -1
View File
@@ -52,7 +52,7 @@ abstract class backup_block_task extends backup_task {
}
$this->blockid = $blockid;
$this->blockname = $block->blockname;
$this->blockname = clean_param($block->blockname, PARAM_PLUGIN);
$this->contextid = context_block::instance($this->blockid)->id;
$this->moduleid = $moduleid;
$this->modulename = null;
+13 -3
View File
@@ -168,6 +168,7 @@ class backup_course_task extends backup_task {
$content = self::encode_links_helper($content, 'BADGESVIEWBYID', '/badges/view.php?type=2&id=');
$content = self::encode_links_helper($content, 'USERINDEXVIEWBYID', '/user/index.php?id=');
$content = self::encode_links_helper($content, 'PLUGINFILEBYCONTEXT', '/pluginfile.php/');
$content = self::encode_links_helper($content, 'PLUGINFILEBYCONTEXTURLENCODED', '/pluginfile.php/', true);
return $content;
}
@@ -178,17 +179,26 @@ class backup_course_task extends backup_task {
* @param string $name the name of this type of encoded link.
* @param string $path the path that identifies this type of link, up
* to the ?paramname= bit.
* @param bool $urlencoded whether to use urlencode() before replacing the path.
* @return string content with one type of link encoded.
*/
static private function encode_links_helper($content, $name, $path) {
private static function encode_links_helper(string $content, string $name, string $path, bool $urlencoded = false) {
global $CFG;
// We want to convert both http and https links.
$root = $CFG->wwwroot;
$httpsroot = str_replace('http://', 'https://', $root);
$httproot = str_replace('https://', 'http://', $root);
$httpsbase = preg_quote($httpsroot . $path, '/');
$httpbase = preg_quote($httproot . $path, '/');
$httpsbase = $httpsroot . $path;
$httpbase = $httproot . $path;
if ($urlencoded) {
$httpsbase = urlencode($httpsbase);
$httpbase = urlencode($httpbase);
}
$httpsbase = preg_quote($httpsbase, '/');
$httpbase = preg_quote($httpbase, '/');
$return = preg_replace('/(' . $httpsbase . ')([0-9]+)/', '$@' . $name . '*$2@$', $content);
$return = preg_replace('/(' . $httpbase . ')([0-9]+)/', '$@' . $name . '*$2@$', $return);
@@ -167,6 +167,7 @@ class restore_course_task extends restore_task {
$rules[] = new restore_decode_rule('BADGESVIEWBYID', '/badges/view.php?type=2&id=$1', 'course');
$rules[] = new restore_decode_rule('USERINDEXVIEWBYID', '/user/index.php?id=$1', 'course');
$rules[] = new restore_decode_rule('PLUGINFILEBYCONTEXT', '/pluginfile.php/$1', 'context');
$rules[] = new restore_decode_rule('PLUGINFILEBYCONTEXTURLENCODED', '/pluginfile.php/$1', 'context', true);
return $rules;
}
+25 -1
View File
@@ -3749,7 +3749,7 @@ class restore_activity_competencies_structure_step extends restore_structure_ste
// Sortorder is ignored by precaution, anyway we should walk through the records in the right order.
$record = (object) $params;
$record->ruleoutcome = $data->ruleoutcome;
$record->overridegrade = $data->overridegrade;
$record->overridegrade = $data->overridegrade ?? 0;
$coursemodulecompetency = new \core_competency\course_module_competency(0, $record);
$coursemodulecompetency->create();
}
@@ -5390,6 +5390,25 @@ class restore_move_module_questions_categories extends restore_execution_step {
];
$params += $categoryidparams;
$DB->execute($sqlupdate, $params);
// As explained in {@see restore_quiz_activity_structure_step::process_quiz_question_legacy_instance()}
// question_set_references relating to random questions restored from old backups,
// which pick from context_module question_categores, will have been restored with the wrong questioncontextid.
// So, now, we need to find those, and updated the questioncontextid.
// We can only find them by picking apart the filter conditions, and seeign which categories they refer to.
// We need to check all the question_set_references belonging to this context_module.
$references = $DB->get_records('question_set_references', ['usingcontextid' => $newcontext->newitemid]);
foreach ($references as $reference) {
$filtercondition = json_decode($reference->filtercondition);
if (!empty($filtercondition->questioncategoryid) &&
in_array($filtercondition->questioncategoryid, $categoryids)) {
// This is one of ours, update the questionscontextid.
$DB->set_field('question_set_references',
'questionscontextid', $newcontext->newitemid,
['id' => $reference->id]);
}
}
}
// Now set the parent id for the question categories that were in the top category in the course context
@@ -6187,6 +6206,11 @@ trait restore_question_set_reference_data_trait {
$data->filtercondition = json_encode($filtercondition);
if ($context = $this->get_mappingid('context', $data->questionscontextid)) {
$data->questionscontextid = $context;
} else {
$this->log('question_set_reference with old id ' . $data->id .
' referenced question context ' . $data->questionscontextid .
' which was not included in the backup. Therefore, this has been ' .
' restored with the old questionscontextid.', backup::LOG_WARNING);
}
$DB->insert_record('question_set_references', $data);
+1 -2
View File
@@ -36,7 +36,7 @@ require_once($CFG->libdir . '/completionlib.php');
* @copyright 2014 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class moodle2_test extends \advanced_testcase {
final class moodle2_test extends \advanced_testcase {
/**
* Tests the availability field on modules and sections is correctly
@@ -1146,7 +1146,6 @@ class moodle2_test extends \advanced_testcase {
'filearea' => 'package',
'itemid' => 0,
'filepath' => '/',
'filepath' => '/',
'filename' => 'dummy.h5p',
'addxapistate' => true,
];
@@ -44,7 +44,18 @@ class restore_decode_rule {
protected $cregexp; // Calculated regular expresion we'll be looking for matches
public function __construct($linkname, $urltemplate, $mappings) {
/** @var bool $urlencoded Whether to use urlencode() on the final URL. */
protected bool $urlencoded;
/**
* Constructor
*
* @param string $linkname How the link has been encoded in backup (CHOICEVIEWBYID, COURSEVIEWBYID...)
* @param string $urltemplate How the original URL looks like, with dollar placeholders
* @param array|string $mappings Which backup_ids mappings do we need to apply for replacing the placeholders
* @param bool $urlencoded Whether to use urlencode() on the final URL (defaults to false)
*/
public function __construct(string $linkname, string $urltemplate, $mappings, bool $urlencoded = false) {
// Validate all the params are ok
$this->mappings = $this->validate_params($linkname, $urltemplate, $mappings);
$this->linkname = $linkname;
@@ -52,6 +63,7 @@ class restore_decode_rule {
$this->restoreid = 0;
$this->sourcewwwroot = '';
$this->targetwwwroot = ''; // yes, uses to be $CFG->wwwroot, and? ;-)
$this->urlencoded = $urlencoded;
$this->cregexp = $this->get_calculated_regexp();
}
@@ -96,6 +108,9 @@ class restore_decode_rule {
} else { // All mappings found, apply target values to the template
$toreplace = str_replace($placeholdersarr, $mappingstargetarr, $toreplace);
}
if ($this->urlencoded) {
$toreplace = urlencode($toreplace);
}
// Finally, perform the replacement in original content
$content = str_replace($tosearch, $toreplace, $content);
}
@@ -50,14 +50,18 @@ class backup_encode_content_test extends \basic_testcase {
// HTTPS root and links of both types in content.
$CFG->wwwroot = $httpsroot;
$encoded = backup_course_task::encode_content_links(
$httproot . '/course/view.php?id=123, ' .
$httpsroot . '/course/view.php?id=123, ' .
$httpsroot . '/grade/index.php?id=123, ' .
$httpsroot . '/grade/report/index.php?id=123, ' .
$httpsroot . '/badges/view.php?type=2&id=123 and ' .
$httpsroot . '/user/index.php?id=123.');
$httproot . '/course/view.php?id=123, ' .
$httpsroot . '/course/view.php?id=123, ' .
$httpsroot . '/grade/index.php?id=123, ' .
$httpsroot . '/grade/report/index.php?id=123, ' .
$httpsroot . '/badges/view.php?type=2&id=123, ' .
$httpsroot . '/user/index.php?id=123, ' .
$httpsroot . '/pluginfile.php/123 and ' .
urlencode($httpsroot . '/pluginfile.php/123') . '.'
);
$this->assertEquals('$@COURSEVIEWBYID*123@$, $@COURSEVIEWBYID*123@$, $@GRADEINDEXBYID*123@$, ' .
'$@GRADEREPORTINDEXBYID*123@$, $@BADGESVIEWBYID*123@$ and $@USERINDEXVIEWBYID*123@$.', $encoded);
'$@GRADEREPORTINDEXBYID*123@$, $@BADGESVIEWBYID*123@$, $@USERINDEXVIEWBYID*123@$, ' .
'$@PLUGINFILEBYCONTEXT*123@$ and $@PLUGINFILEBYCONTEXTURLENCODED*123@$.', $encoded);
// HTTP root and links of both types in content.
$CFG->wwwroot = $httproot;
@@ -66,10 +70,14 @@ class backup_encode_content_test extends \basic_testcase {
$httpsroot . '/course/view.php?id=123, ' .
$httproot . '/grade/index.php?id=123, ' .
$httproot . '/grade/report/index.php?id=123, ' .
$httproot . '/badges/view.php?type=2&id=123 and ' .
$httproot . '/user/index.php?id=123.');
$httproot . '/badges/view.php?type=2&id=123, ' .
$httproot . '/user/index.php?id=123, ' .
$httproot . '/pluginfile.php/123 and ' .
urlencode($httproot . '/pluginfile.php/123') . '.'
);
$this->assertEquals('$@COURSEVIEWBYID*123@$, $@COURSEVIEWBYID*123@$, $@GRADEINDEXBYID*123@$, ' .
'$@GRADEREPORTINDEXBYID*123@$, $@BADGESVIEWBYID*123@$ and $@USERINDEXVIEWBYID*123@$.', $encoded);
'$@GRADEREPORTINDEXBYID*123@$, $@BADGESVIEWBYID*123@$, $@USERINDEXVIEWBYID*123@$, ' .
'$@PLUGINFILEBYCONTEXT*123@$ and $@PLUGINFILEBYCONTEXTURLENCODED*123@$.', $encoded);
$CFG->wwwroot = $oldroot;
}
}
+10 -10
View File
@@ -134,14 +134,14 @@ class core_backup_renderer extends plugin_renderer_base {
$html .= $this->backup_detail_pair(get_string('backupmode', 'backup'), get_string('backupmode'.$details->mode, 'backup'));
$html .= $this->backup_detail_pair(get_string('backupdate', 'backup'), userdate($details->backup_date));
$html .= $this->backup_detail_pair(get_string('moodleversion', 'backup'),
html_writer::tag('span', $details->moodle_release, array('class' => 'moodle_release')).
html_writer::tag('span', '['.$details->moodle_version.']', array('class' => 'moodle_version sub-detail')));
html_writer::tag('span', s($details->moodle_release), array('class' => 'moodle_release')).
html_writer::tag('span', '[' . s($details->moodle_version) .']', array('class' => 'moodle_version sub-detail')));
$html .= $this->backup_detail_pair(get_string('backupversion', 'backup'),
html_writer::tag('span', $details->backup_release, array('class' => 'moodle_release')).
html_writer::tag('span', '['.$details->backup_version.']', array('class' => 'moodle_version sub-detail')));
html_writer::tag('span', s($details->backup_release), array('class' => 'moodle_release')).
html_writer::tag('span', '[' . s($details->backup_version) . ']', array('class' => 'moodle_version sub-detail')));
$html .= $this->backup_detail_pair(get_string('originalwwwroot', 'backup'),
html_writer::tag('span', $details->original_wwwroot, array('class' => 'originalwwwroot')).
html_writer::tag('span', '['.$details->original_site_identifier_hash.']', array('class' => 'sitehash sub-detail')));
html_writer::tag('span', s($details->original_wwwroot), array('class' => 'originalwwwroot')).
html_writer::tag('span', '[' . s($details->original_site_identifier_hash) . ']', array('class' => 'sitehash sub-detail')));
if (!empty($details->include_file_references_to_external_content)) {
$message = '';
if (backup_general_helper::backup_is_samesite($details)) {
@@ -169,8 +169,8 @@ class core_backup_renderer extends plugin_renderer_base {
$html .= html_writer::start_tag('div', ['class' => 'backup-section',
'role' => 'table', 'aria-labelledby' => 'backupcoursedetailsheader']);
$html .= $this->output->heading(get_string('backupcoursedetails', 'backup'), 2, 'header', 'backupcoursedetailsheader');
$html .= $this->backup_detail_pair(get_string('coursetitle', 'backup'), $details->course->title);
$html .= $this->backup_detail_pair(get_string('courseid', 'backup'), $details->course->courseid);
$html .= $this->backup_detail_pair(get_string('coursetitle', 'backup'), format_string($details->course->title));
$html .= $this->backup_detail_pair(get_string('courseid', 'backup'), clean_param($details->course->courseid, PARAM_INT));
// Warning users about front page backups.
if ($details->original_course_format === 'site') {
@@ -188,7 +188,7 @@ class core_backup_renderer extends plugin_renderer_base {
} else {
continue;
}
$html .= $this->backup_detail_pair(get_string('backupcoursesection', 'backup', $section->title), $value);
$html .= $this->backup_detail_pair(get_string('backupcoursesection', 'backup', format_string($section->title)), $value);
$table = null;
foreach ($details->activities as $activitykey => $activity) {
if ($activity->sectionid != $section->sectionid) {
@@ -206,7 +206,7 @@ class core_backup_renderer extends plugin_renderer_base {
$icon = new image_icon('monologo', '', $activity->modulename, ['class' => 'iconlarge icon-pre']);
$table->data[] = array(
$this->output->render($icon).$name,
$activity->title,
format_string($activity->title),
($activity->settings[$activitykey.'_userinfo']) ? $yestick : $notick,
);
}
+2 -1
View File
@@ -107,9 +107,10 @@ if (!has_any_capability(array(
$PAGE->set_title($hdr);
$output = $PAGE->get_renderer('core', 'badges');
if (($delete || $archive) && has_capability('moodle/badges:deletebadge', $PAGE->context)) {
if ($delete || $archive) {
$badgeid = ($archive != 0) ? $archive : $delete;
$badge = new badge($badgeid);
require_capability('moodle/badges:deletebadge', $badge->get_context());
if (!$confirm) {
echo $output->header();
// Archive this badge?
@@ -119,3 +119,97 @@ Feature: Award badges with separate groups
And I press "Award badge"
# Teacher 2 shouldn't be able to go further
Then I should see "Sorry, but you need to be part of a group to see this page."
@javascript
Scenario: Editing teacher can award badge to members of separate groups
Given I am on the "Course 1" course page logged in as teacher1
And I navigate to "Badges > Manage badges" in current page administration
And I follow "Course Badge"
And I press "Award badge"
When I set the field "role" to "Teacher"
# Confirm that editing teacher sees a separate groups dropdown menu.
Then "Separate groups" "select" should exist
And I should see "All participants" in the "Separate groups" "select"
# Confirm that all participants are displayed when All participants is selected.
And I should see "Student 1" in the "potentialrecipients[]" "select"
And I should see "Student 2" in the "potentialrecipients[]" "select"
And I should see "Teacher 1" in the "potentialrecipients[]" "select"
And I should see "Teacher 2" in the "potentialrecipients[]" "select"
And I set the field "Separate groups" to "Class A"
# Confirm that only members of selected group are displayed
And I should not see "Student 1" in the "potentialrecipients[]" "select"
And I should not see "Teacher 1" in the "potentialrecipients[]" "select"
And I should see "Student 2" in the "potentialrecipients[]" "select"
And I should see "Teacher 2" in the "potentialrecipients[]" "select"
And I set the field "Separate groups" to "Class B"
And I should not see "Student 2" in the "potentialrecipients[]" "select"
And I should not see "Teacher 2" in the "potentialrecipients[]" "select"
And I should see "Student 1" in the "potentialrecipients[]" "select"
And I should see "Teacher 1" in the "potentialrecipients[]" "select"
@javascript
Scenario Outline: Teacher can award badge to members of visible groups
Given I am on the "Course 1" "course editing" page logged in as teacher1
And I expand all fieldsets
# Set the group mode to visible groups.
And I set the field "Group mode" to "Visible groups"
And I press "Save and display"
When I am on the "Course 1" course page logged in as <loggedinuser>
And I navigate to "Badges > Manage badges" in current page administration
And I follow "Course Badge"
And I press "Award badge"
And I set the field "role" to "<awarder>"
# Confirm that teachers see a visible groups dropdown menu.
Then "Visible groups" "select" should exist
# Confirm that My groups option group exists.
And "optgroup[label='My groups']" "css_element" should exist in the "select[name='group']" "css_element"
# Confirm that Other groups option group exists.
And "optgroup[label='Other groups']" "css_element" should exist in the "select[name='group']" "css_element"
# Confirm that all participants are displayed when All participants is selected.
And I set the field "Visible groups" to "All participants"
And I should see "Student 1" in the "potentialrecipients[]" "select"
And I should see "Student 2" in the "potentialrecipients[]" "select"
And I should see "Teacher 1" in the "potentialrecipients[]" "select"
And I should see "Teacher 2" in the "potentialrecipients[]" "select"
# Confirm that only members of selected group are displayed.
And I set the field "Visible groups" to "Class A"
And I should not see "Student 1" in the "potentialrecipients[]" "select"
And I should not see "Teacher 1" in the "potentialrecipients[]" "select"
And I should see "Student 2" in the "potentialrecipients[]" "select"
And I should see "Teacher 2" in the "potentialrecipients[]" "select"
And I set the field "Visible groups" to "Class B"
And I should not see "Student 2" in the "potentialrecipients[]" "select"
And I should not see "Teacher 2" in the "potentialrecipients[]" "select"
And I should see "Student 1" in the "potentialrecipients[]" "select"
And I should see "Teacher 1" in the "potentialrecipients[]" "select"
Examples:
| loggedinuser | awarder |
| teacher1 | Teacher |
| teacher2 | Non-editing teacher |
@javascript
Scenario Outline: Teacher can award badge to members when group mode is set to no groups
Given I am on the "Course 1" "course editing" page logged in as teacher1
And I expand all fieldsets
# Set the group mode to no groups.
And I set the field "Group mode" to "No groups"
And I press "Save and display"
When I am on the "Course 1" course page logged in as <loggedinuser>
And I navigate to "Badges > Manage badges" in current page administration
And I follow "Course Badge"
And I press "Award badge"
And I set the field "role" to "<awarder>"
# Confirm that no group dropdowns don't exist.
Then "Separate groups" "select" should not exist
And "Visible groups" "select" should not exist
# Confirm all participants are displayed.
And I should see "Student 1" in the "potentialrecipients[]" "select"
And I should see "Student 2" in the "potentialrecipients[]" "select"
And I should see "Teacher 1" in the "potentialrecipients[]" "select"
And I should see "Teacher 2" in the "potentialrecipients[]" "select"
Examples:
| loggedinuser | awarder |
| teacher1 | Teacher |
| teacher2 | Non-editing teacher |
@@ -10,8 +10,8 @@ Feature: View a site event on the dashboard
| student1 | Student | 1 | student1@example.com | S1 |
And I log in as "admin"
And I create a calendar event with form data:
| id_eventtype | Site |
| id_name | Site Event |
| id_eventtype | Site |
| id_name | Site Event |
And I log out
@javascript
@@ -29,5 +29,5 @@ Feature: View a site event on the dashboard
# We need to give the browser a couple seconds to re-render the page after the screen has been resized.
And I wait "1" seconds
And I should not see "Site Event"
And I hover over today in the mini-calendar block
When I hover over today in the mini-calendar block responsive view
And I should see "Site Event"
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+5 -1
View File
@@ -551,7 +551,11 @@ const itemsPerPageFunc = (pagingLimit, root) => {
// Filter out all pagination options which are too large for the amount of courses user is enrolled in.
const totalCourseCount = parseInt(root.find(SELECTORS.courseView.region).attr('data-totalcoursecount'), 10);
return itemsPerPage.filter(pagingOption => {
return pagingOption.value < totalCourseCount || pagingOption.value === 0;
if (pagingOption.value === 0 && totalCourseCount > 100) {
// To minimise performance issues, do not show the "All" option if the user is enrolled in more than 100 courses.
return false;
}
return pagingOption.value < totalCourseCount;
});
};
+8 -1
View File
@@ -363,7 +363,14 @@ class main implements renderable, templatable {
if (!$this->displaygroupingcustomfield) {
return [];
}
$fieldid = $DB->get_field('customfield_field', 'id', ['shortname' => $this->customfiltergrouping]);
// Get the relevant customfield ID within the core_course/course component/area.
$fieldid = $DB->get_field_sql("
SELECT f.id
FROM {customfield_field} f
JOIN {customfield_category} c ON c.id = f.categoryid
WHERE f.shortname = :shortname AND c.component = 'core_course' AND c.area = 'course'
", ['shortname' => $this->customfiltergrouping]);
if (!$fieldid) {
return [];
}
@@ -51,8 +51,7 @@
<div class="text-xs-center text-center mt-3" data-region="empty-message">
<img class="empty-placeholder-image-lg mt-1"
src="{{nocoursesimg}}"
alt="{{{ title }}}"
role="presentation"
alt=""
>
<h5 class="h5 mt-3 mb-0">{{{ title }}}</h5>
<p class="mt-3 mb-0">{{{ intro }}}</p>
@@ -70,3 +70,8 @@ Feature: Zero state on my overview block
And "Create course" "button" should exist
And I click on "Create course" "button"
And I should see "Add a new course"
@accessibility
Scenario: Evaluate the accessibility of the My courses (zero state)
When I am on the "My courses" page logged in as "manager"
Then the page should meet accessibility standards
@@ -58,7 +58,7 @@ class helper {
FROM {block_recentlyaccesseditems} rai
JOIN {course} c ON c.id = rai.courseid
WHERE userid = :userid
ORDER BY rai.timeaccess DESC";
ORDER BY rai.timeaccess DESC, rai.id DESC";
$records = $DB->get_records_sql($sql, $paramsql);
$order = 0;
@@ -27,9 +27,8 @@
<div class="text-xs-center text-center mt-4" data-region="empty-message">
<img
src="{{noitemsimgurl}}"
alt="{{#str}} noitems, block_recentlyaccesseditems {{/str}}"
role="presentation"
alt=""
style="height: 70px; width: 70px;"
>
<p class="text-muted mt-3 mb-0">{{#str}} noitems, block_recentlyaccesseditems {{/str}}</p>
</div>
</div>
@@ -42,19 +42,21 @@
<div class="card-deck dashboard-card-deck one-row" data-region="items-list" role="list">
{{#items}}
<a class="card dashboard-card mb-1" href="{{{viewurl}}}" title="{{{name}}}" role="listitem">
<div class="card-body p-2 m-1">
<div class="d-flex text-truncate">
<div class="d-flex align-self-center activityiconcontainer {{purpose}}">
{{{icon}}}
</div>
<div class="w-100 line-height-3 text-truncate ml-2">
<h6 class="mb-0 text-truncate"><span class="clickable">{{{name}}}</span></h6>
<small class="text-truncate mb-0">{{{coursename}}}</small>
<div class="card dashboard-card" role="listitem">
<a class="mb-1" href="{{{viewurl}}}" title="{{{name}}}">
<div class="card-body p-2 m-1">
<div class="d-flex text-truncate">
<div class="d-flex align-self-center activityiconcontainer {{purpose}}">
{{{icon}}}
</div>
<div class="w-100 line-height-3 text-truncate ml-2">
<h6 class="mb-0 text-truncate"><span class="clickable">{{{name}}}</span></h6>
<small class="text-truncate mb-0">{{{coursename}}}</small>
</div>
</div>
</div>
</div>
</a>
</a>
</div>
{{/items}}
</div>
{{#hasmoreitems}}
@@ -23,15 +23,19 @@ Feature: The recently accessed items block allows users to easily access their m
| name | Test forum name |
And I log in as "student1"
@accessibility
Scenario: User has not accessed any item
Then I should see "No recent items" in the "Recently accessed items" "block"
And the page should meet accessibility standards
@accessibility
Scenario: User has accessed some items
Given I change window size to "large"
When I am on the "Test forum name" "forum activity" page
And I follow "Dashboard"
Then I should see "Test forum name" in the "Recently accessed items" "block"
And I should not see "Show more items" in the "Recently accessed items" "block"
And the page should meet accessibility standards
Scenario: User has accessed more than 3 items
Given the following "activities" exist:
+12 -1
View File
@@ -180,7 +180,18 @@ $PAGE->set_pagelayout('admin');
if ($rssid) {
$isadding = false;
$rssrecord = $DB->get_record('block_rss_client', array('id' => $rssid), '*', MUST_EXIST);
if ($managesharedfeeds) {
$select = 'id = :id AND (userid = :userid OR shared = 1)';
} else {
$select = 'id = :id AND userid = :userid';
}
$rssrecord = $DB->get_record_select('block_rss_client', $select, [
'id' => $rssid,
'userid' => $USER->id,
], '*', MUST_EXIST);
} else {
$isadding = true;
$rssrecord = new stdClass;

Some files were not shown because too many files have changed in this diff Show More