Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: Mdl 72188 master seb js integration dev #1

Open
wants to merge 96 commits into
base: master-seb
Choose a base branch
from

Conversation

andrewmadden
Copy link

*** PLEASE DO NOT OPEN PULL REQUESTS VIA GITHUB ***

The moodle.git repository at Github is just a mirror of the official repository. We do not accept pull requests at Github.

See CONTRIBUTING.txt guidelines for how to contribute patches for Moodle. Thank you.

--

sharidas and others added 30 commits November 8, 2021 16:53
Add breadcrumbs to the calendar page.
Checks if a form element has attributes before
trying to get the default value. This fixes
an error when trying to get the default value
for a frozen group which does not have the
attributes array.
The new get_safe_orderby() and get_safe_orderby_multiple() methods
provide a centralised safe way for user submitted sorting values to be
incorporated into SQL ORDER BY. They do this by removing the need for
user submitted data to pass in any SQL and not allowing arbitrary
column values, instead using string keys which map to a predefined
list of allowed sortable columns.
Also use the new {{#cleanstr}} helper where it was more appropriate
than the {{#str} helper.
The format_string() function does half html escaping. It escapes < and >
characters, but does not escape ". Therefore, it put us in a situation
where neither {{}}, nor {{{}}} are suitable in templates. If we use {{}}
for an attribute (like title or aria-label), then < and > characters
will be double escaped. On the other hand, if we use {{{}}} there, a
double quote character will break HTML when it is used in an attribute.
Therefore, neither {{}}, nore {{{}}} are usable in html attributes.

Moreover, The title attribute here was redundant because it had the same
value as the link's text.
@andrewmadden
Copy link
Author

Adding comment as a reminder. We need to decide on minumum SEB versions for all platforms and update the internal message and plugin docs.

@andrewmadden andrewmadden force-pushed the MDL-72188-master_seb_js_integration-DEV branch from bab9a64 to f1829b7 Compare December 10, 2021 11:26
if (window.SafeExamBrowser !== null) {
await View.addLoadingAlert();
// If the SEB keys are already set, we can call our callback directly.
if (window.SafeExamBrowser.security.configKey !== ":" || window.SafeExamBrowser.security.browserExamKey !== ":") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we check it like !==":"?

*
* @return bool True if one or more keys are set in quiz settings.
*/
public function valid_browser_exam_key_exists(): bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this method be public? Is it used anywhere outside of that class?
Also the name is a bit confusing for me as I would think it check key in a browser and not setting. Maybe rename to something like is_allowed_browser_examkeys_configured to stress that we are checking it in settings

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Changed name, made private, and removed related unit tests.

$valid = $this->check_browser_exam_keys($validbrowserexamkeys, $browserexamkey, $url);

if (!$valid) {
access_prevented::create_strict($this, $this->get_reason_text('invalid_browser_key'))->trigger();
Copy link
Member

@dmitriim dmitriim Dec 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those events shouldn't be in this class. They should be closer to where we actually prevent the access. That may require refactoring web service and get rid of validate_seb_keys method to make ws code looks like the original prevent_access method.

@andrewmadden andrewmadden force-pushed the MDL-72188-master_seb_js_integration-DEV branch from f1829b7 to 3afa052 Compare December 14, 2021 05:23
* Replaces checking header for SEB config keys to assess quiz access.
* Adds new web service accessible via Ajax
* Forces the use of the new API where available
* Stores access in Moodle SESSION for quiz instead of checking every
page.
@andrewmadden andrewmadden force-pushed the MDL-72188-master_seb_js_integration-DEV branch from 8025e8f to 655d22d Compare January 30, 2022 22:39
srdjan-catalyst pushed a commit that referenced this pull request Jun 16, 2022
Adds behat support for selecting a date from the date selector element.
The passed values should represent a textual date description wrapped
in '##' (e.g. '##first day of January 2020##', '##1 Jan 2020##'). Also,
the value 'disabled' is valid and can be used to disable the date
selector element.
srdjan-catalyst pushed a commit that referenced this pull request Jun 16, 2022
Adds behat support for selecting date and time from a datetime selector
element. The passed values should represent a textual date and time
description wrapped in '##' (e.g. '##first day of January 2020 08:00##',
'##1 Jan 2020 10:30##'). Also, the value 'disabled' is valid and can be
used to disable the datetime selector element.
srdjan-catalyst pushed a commit that referenced this pull request Jun 16, 2022
Adds behat support for selecting a date from the date selector element.
The passed values should represent a textual date description wrapped
in '##' (e.g. '##first day of January 2020##', '##1 Jan 2020##'). Also,
the value 'disabled' is valid and can be used to disable the date
selector element.
srdjan-catalyst pushed a commit that referenced this pull request Jun 16, 2022
Adds behat support for selecting date and time from a datetime selector
element. The passed values should represent a textual date and time
description wrapped in '##' (e.g. '##first day of January 2020 08:00##',
'##1 Jan 2020 10:30##'). Also, the value 'disabled' is valid and can be
used to disable the datetime selector element.
x-iy pushed a commit that referenced this pull request Nov 16, 2023
We encountered errors on the plugin check page while upgrading from version 3.11 to 4.3.
The plugins marked with the status "To be deleted" have a null value for the $component property,
which results in the following error message:
"Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is
deprecated in lib/classes/component.php on line 1056."
To avoid this error, we need to set an empty string as the default value for the $component property.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.