269 Commits

Author SHA1 Message Date
Jun Pataleta
a180dba314
MDL-81549 versions: bump all versions and requires near release 2024-04-17 00:03:29 +08:00
Jake Dallimore
1826c5e1d4
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:41:50 +08:00
Jake Dallimore
4c2b9f55f0
Merge branch 'MDL-81405-master' of https://github.com/jleyva/moodle 2024-04-08 15:35:00 +08:00
Juan Leyva
e09930bab6 MDL-81405 session: New core cookie helper utility class 2024-04-06 12:20:59 +02:00
Jake Dallimore
334ec98980
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 15:27:24 +08:00
Daniel Ziegenberg
87267da39d
MDL-81281 phpunit: assertObjectNotHasAttribute is deprecated
To be integrated as part of MDL-81266

When running PHPUnit 9.6 we get the following deprecation warnings:
"assertObjectNotHasAttribute() is deprecated and will be removed in PHPUnit
10. Refactor your test to use assertObjectNotHasProperty() instead."

So we replace all instances of assertObjectNotHasAttribute with
assertObjectNotHasProperty.

PHPUnit justifies the change with:
> PHPUnit currently refers to "fields" (see above) as "attributes". This
> is (or will become) confusing considering the introduction of
> attributes in PHP 8 and their support in PHPUnit.  PHPUnit will be
> changed to use the term "property" instead of "attribute" where "field"
> is meant.

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
2024-03-25 16:21:07 +01:00
Jake Dallimore
35e82b9fad
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:35:48 +08:00
Jake Dallimore
aea624fcb0
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:35:48 +08:00
Jake Dallimore
b293cb5da6
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:35:48 +08:00
Eloy Lafuente (stronk7)
361dfe8145
MDL-75952 general: Since php81, refection->setAccessible() is no-op
Refereces:
- https://wiki.php.net/rfc/make-reflection-setaccessible-no-op
- https://www.php.net/manual/en/reflectionproperty.setaccessible.php
- https://www.php.net/manual/en/reflectionmethod.setaccessible.php

As of PHP 8.1.0, calling this method has no effect; all methods are
invokable by default. So, let's remove all uses from core, they are
no-op.
2024-03-10 21:15:00 +01:00
Jun Pataleta
3278ce7aba
Merge branch 'MDL-65292' of https://github.com/stronk7/moodle 2024-03-08 08:00:41 +08:00
Jake Dallimore
c043c180de
MDL-79675 enrol_lti: fix mocks depending on previously untyped props
When $launch_id wasn't typed, it was ok to call the getter, but now
that it is, php throws an error. Replaced with stub method.
2024-03-06 08:44:14 +08:00
Jake Dallimore
4fda419e88
MDL-79675 enrol_lti: fix class instantiation after library upgrade 2024-03-06 08:44:14 +08:00
Jake Dallimore
7c9fb5d89b
MDL-79675 enrol_lti: fix client implementation signatures after upgrade
Not strictly required due to contravariance, but nice for readability.
2024-03-06 08:44:14 +08:00
Jake Dallimore
73ce114066
MDL-79675 enrol_lti: fix deep linking return after library removals 2024-03-06 08:44:14 +08:00
Jake Dallimore
2a783ec964
MDL-79675 enrol_lti: fix JWKS generation after library removals 2024-03-06 08:44:14 +08:00
Jake Dallimore
eb94b5677c
MDL-79675 enrol_lti: fix login redirection after library deprecations
v5.7.0 changed this process. Now, we just fetch the URL and do our own
redirect.
https://github.com/packbackbooks/lti-1-3-php-library/releases/tag/v5.7.0
2024-03-06 08:44:14 +08:00
Jake Dallimore
f7c12a372d
MDL-79675 enrol_lti: migrate validate() calls to initialize() per v6.0.0
Calls to validate() have been replaced in v6.0.0.
https://github.com/packbackbooks/lti-1-3-php-library/releases/tag/v6.0.0
2024-03-06 08:44:14 +08:00
Jake Dallimore
7560375ad6
MDL-79675 enrol_lti: replace ImsCookie use with local implementation
The default implementation, previously included with the library, is no
longer shipped there. Clients must provide their own implementation of
the ICookie interface instead.
2024-03-06 08:44:14 +08:00
Eloy Lafuente (stronk7)
ba1f804ffa
MDL-65292 style: Fix all function declarations white space
This has been generated running the following Sniffs, all
them part of the Moodle's CodeSniffer standard:
- PSR12.Functions.ReturnTypeDeclaration
- PSR12.Functions.NullableTypeDeclaration
- moodle.Methods.MethodDeclarationSpacing
- Squiz.Whitespace.ScopeKeywordSpacing

All them are, exclusively, about correct spacing, so the changes
are, all them, only white space changes.

Only exceptions to the above are 3 changes what were setting the
return type in a new line, and, when that happens, the closing
parenthesis (bracket) has to go to the same line than the colon.
2024-02-28 23:33:26 +01:00
Sara Arjona
8b36abdb9d
Merge branch 'MDL-80259-main' of https://github.com/roland04/moodle 2024-01-24 09:16:12 +01:00
Mikel Martín
a198884333 MDL-80259 theme_boost: Refactor badge helper classes for Bootstrap 5 2024-01-23 08:27:23 +01:00
Jake Dallimore
0e74284dfc
MDL-78219 enrol_lti: fix auth method usage in base testcase 2024-01-15 15:41:52 +08:00
Andrew Nicols
525212f2d2
MDL-78496 core: Address phpcs issues with upgrade.php files 2023-11-19 21:20:53 +08:00
Andrew Nicols
545b36cd4a
MDL-78496 upgrade: remove all the < 4.1.0 upgrade steps
Also includes an upgrade step to prevent upgrading from any
version < 2021112802 (v4.1.0) as anti-cheating measure.
2023-11-17 23:25:36 +08:00
Jun Pataleta
9beff03a96
MDL-79626 upgrade: add the 4.3.0 separation line to all upgrade scripts 2023-10-10 10:44:17 +08:00
Jun Pataleta
94bc2cd38b
MDL-79551 versions: bump all versions and requires near release 2023-10-04 13:57:17 +08:00
Sara Arjona
ff844ab7bd
MDL-78993 theme: Remove $CFG->svgicons
The $CFG->svgicons setting was introduced in Moodle 2.4 due to incomplete
SVG support in certain web browsers.
The landscape has evolved significantly since then, and all modern browsers
now handle SVG files correctly.
The $CFG->svgicons settings has been removed and the supports_svg() method
has been updated with currently supported browsers (IE support was removed
in Moodle 3.10).
2023-09-12 15:28:03 +02:00
Andrew Nicols
4fcf078ef9
MDL-76557 enrol_lti: Fix unit test docs and convert to provider 2023-08-17 09:12:36 +02:00
ishatalkin
d9e182b5c6 MDL-76557 enrol_lti: sync_grades accepts status codes 200,201,202,204 2023-08-15 12:25:06 +03:00
Huong Nguyen
1e804cdb6a
Merge branch 'MDL-78578-master' of https://github.com/snake/moodle 2023-07-04 15:15:33 +07:00
Jake Dallimore
83d34cd1cc
MDL-78599 enrol_lti: fix SQL syntax error in course grade sync 2023-06-28 12:39:03 +08:00
Jake Dallimore
013e6fd32e
MDL-78599 enrol_lti: test covering decoupled, course context grade syncs
This covers the case where a course is published and the launch data
doesn't include the 'lineitem' property of the ags claim, meaning the
tool can manage its own line items.
2023-06-28 12:38:54 +08:00
Jake Dallimore
1e6a7b2b63
MDL-78578 enrol_lti: permit launch cache access during launch redirects
This handles things like site policies, which store the current URL,
redirect to the policy agreement, then redirect back the current URL
afterwards. In such cases, we want to redirect back with 'launchid' set
so that we can fetch the id_token from the session cache. This is the
same thing we already do during account binding, so the patch only
makes sure the PAGE->url is properly set before calling require_login.
2023-06-27 10:01:49 +08:00
Jake Dallimore
b42e47fb4a
MDL-78066 enrol_lti: fix deep linking error in multiple grade items case
If an activity, like workshop or forum, has multiple grade items,
declarative binding of the grade item (line item) isn't supported.
Instead of throwing an exception, handle the case more elegantly
and just omit the 'add to gradebook' option for these activities.
2023-06-15 09:38:43 +08:00
Jake Dallimore
8da6304e0e
MDL-78066 enrol_lti: test showing multi-grade-items failure
This test demonstrates the failure of the repository to properly fetch
published resources which are compatible with declarative line item
binding.
2023-06-15 09:38:31 +08:00
Andrew Nicols
b610b9adbe
Merge branch 'MDL-77933-master' of https://github.com/snake/moodle 2023-06-08 12:02:58 +08:00
Andrew Nicols
212e27c5ac
Merge branch 'MDL-76821-master' of https://github.com/snake/moodle 2023-06-08 11:28:55 +08:00
Jake Dallimore
6f54ece655
MDL-77933 enrol_lti: return site name and logo during registration
Instead of the Moodle icon and the 'moodle' lang string, return the
site fullname and compact logo during dynamic registration.
2023-06-08 11:28:26 +08:00
Jake Dallimore
22b0565ef1
MDL-76842 enrol_lti: fix user record updates in user_repository
Only call user_update_user when the relevant user data has changed,
preventing unnecessary user_updated events. This also removes the
line setting timemodified on the user since user_update_user already
handles this.
2023-06-08 10:27:16 +08:00
Jake Dallimore
b1e550a229
MDL-76842 enrol_lti: test confirming the erroneous user_updated events
This test will fail until the fix - only updating users when data has
changed - is put in place in the following commit.
2023-06-08 09:29:56 +08:00
Sara Arjona
36de54c1f8 Merge branch 'MDL-77350-master' of https://github.com/meirzamoodle/moodle 2023-05-17 08:27:26 +02:00
Ilya Tregubov
38230b57e4
Merge branch 'MDL-77840-master' of https://github.com/davewoloszyn/moodle 2023-05-16 09:46:05 +08:00
Meirza
66858f7f6c MDL-77350 enrol: Added class properties that are not declared
In PHP 8.2 and later, setting a value to an undeclared class property is
deprecated and emits a deprecation notice.
So we need to add missing class properties that still need to be declared.
2023-05-16 00:33:19 +07:00
Jake Dallimore
a34d5ee92b MDL-76821 enrol_lti: prevent legacy launches via upgraded enrolment
If the enrolment instance (the 'published resource') has been upgraded
from LTI 1.1/2.0 to LTI 1.3 (i.e. a new instance was not created),
prevent legacy launches which may occur from old resource links. Only
LTI Advantage launches should be permitted through the method.
2023-05-05 17:07:21 +08:00
Jake Dallimore
faa3878abb MDL-76821 enrol_lti: fix bug in repo causing return of legacy lti users
If the enrolment method is updated from an LTI 1.1/2.0 tool to an LTI
1.3 tool, it may have associated enrol_lti_users records not having
ltideploymentid values. These are legacy users and must not be returned
by the repository, which deals only with LTI 1.3 LTI users.
2023-05-05 17:07:12 +08:00
David Woloszyn
c713e970a6 MDL-77840 enrol_lti: Avoid passing nulls to base64_encode 2023-05-03 09:32:18 +10:00
Jun Pataleta
9095bb0ef9 MDL-78000 upgrade: add the 4.2.0 separation line to all upgrade scripts 2023-04-22 23:17:50 +08:00
Eloy Lafuente (stronk7)
061c9d7ba0 MDL-77940 versions: bump all versions and requires near release
version = 2023042400 release version
requires= 2023041800 current rc1 version
2023-04-18 18:08:09 +02:00
Marina Glancy
8fc1486d36 MDL-77164 various: fix incorrect phpdocs 2023-04-13 11:35:06 +01:00