mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
Merge branch 'MDL-67818-check-api-fixes' of https://github.com/brendanheywood/moodle
This commit is contained in:
commit
c8eca1f642
25 changed files with 249 additions and 142 deletions
|
@ -39,12 +39,12 @@ use core\check\result;
|
||||||
class noauth extends \core\check\check {
|
class noauth extends \core\check\check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* A link to a place to action this
|
||||||
|
*
|
||||||
|
* @return action_link
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_action_link(): ?\action_link {
|
||||||
$this->id = 'noauth';
|
return new \action_link(
|
||||||
$this->name = get_string('check_noauth_name', 'auth_none');
|
|
||||||
$this->actionlink = new \action_link(
|
|
||||||
new \moodle_url('/admin/settings.php?section=manageauths'),
|
new \moodle_url('/admin/settings.php?section=manageauths'),
|
||||||
get_string('authsettings', 'admin'));
|
get_string('authsettings', 'admin'));
|
||||||
}
|
}
|
||||||
|
@ -54,15 +54,14 @@ class noauth extends \core\check\check {
|
||||||
* @return result
|
* @return result
|
||||||
*/
|
*/
|
||||||
public function get_result(): result {
|
public function get_result(): result {
|
||||||
|
|
||||||
if (is_enabled_auth('none')) {
|
if (is_enabled_auth('none')) {
|
||||||
$status = result::ERROR;
|
$status = result::ERROR;
|
||||||
$summary = get_string('check_noauth_error', 'auth_none');
|
$summary = get_string('checknoautherror', 'auth_none');
|
||||||
} else {
|
} else {
|
||||||
$status = result::OK;
|
$status = result::OK;
|
||||||
$summary = get_string('check_noauth_ok', 'auth_none');
|
$summary = get_string('checknoauthok', 'auth_none');
|
||||||
}
|
}
|
||||||
$details = get_string('check_noauth_details', 'auth_none');
|
$details = get_string('checknoauthdetails', 'auth_none');
|
||||||
|
|
||||||
return new result($status, $summary, $details);
|
return new result($status, $summary, $details);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
$string['auth_nonedescription'] = 'Users can sign in and create valid accounts immediately, with no authentication against an external server and no confirmation via email. Be careful using this option - think of the security and administration problems this could cause.';
|
$string['auth_nonedescription'] = 'Users can sign in and create valid accounts immediately, with no authentication against an external server and no confirmation via email. Be careful using this option - think of the security and administration problems this could cause.';
|
||||||
$string['pluginname'] = 'No authentication';
|
$string['pluginname'] = 'No authentication';
|
||||||
$string['privacy:metadata'] = 'The No authentication plugin does not store any personal data.';
|
$string['privacy:metadata'] = 'The No authentication plugin does not store any personal data.';
|
||||||
$string['check_noauth_details'] = '<p>The <em>No authentication</em> plugin is not intended for production sites. Please disable it unless this is a development test site.</p>';
|
$string['checknoauthdetails'] = '<p>The <em>No authentication</em> plugin is not intended for production sites. Please disable it unless this is a development test site.</p>';
|
||||||
$string['check_noauth_error'] = 'The No authentication plugin cannot be used on production sites.';
|
$string['checknoautherror'] = 'The No authentication plugin cannot be used on production sites.';
|
||||||
$string['check_noauth_name'] = 'No authentication';
|
$string['checknoauth'] = 'No authentication';
|
||||||
$string['check_noauth_ok'] = 'The no authentication plugin is disabled.';
|
$string['checknoauthok'] = 'The no authentication plugin is disabled.';
|
||||||
|
|
|
@ -41,13 +41,22 @@ use core\check\result;
|
||||||
class defaultuserrole extends check {
|
class defaultuserrole extends check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Get the short check name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_name(): string {
|
||||||
|
return get_string('check_defaultuserrole_name', 'report_security');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A link to a place to action this
|
||||||
|
*
|
||||||
|
* @return action_link|null
|
||||||
|
*/
|
||||||
|
public function get_action_link(): ?\action_link {
|
||||||
global $CFG;
|
global $CFG;
|
||||||
$this->id = 'defaultuserrole';
|
return new \action_link(
|
||||||
$this->name = get_string('check_defaultuserrole_name', 'report_security');
|
|
||||||
$this->actionlink = new \action_link(
|
|
||||||
new \moodle_url('/admin/roles/define.php?action=view&roleid=' . $CFG->defaultuserroleid),
|
new \moodle_url('/admin/roles/define.php?action=view&roleid=' . $CFG->defaultuserroleid),
|
||||||
get_string('userpolicies', 'admin'));
|
get_string('userpolicies', 'admin'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,12 +41,21 @@ use core\check\result;
|
||||||
class frontpagerole extends check {
|
class frontpagerole extends check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Get the short check name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_name(): string {
|
||||||
$this->id = 'frontpagerole';
|
return get_string('check_frontpagerole_name', 'report_security');
|
||||||
$this->name = get_string('check_frontpagerole_name', 'report_security');
|
}
|
||||||
$this->actionlink = new \action_link(
|
|
||||||
|
/**
|
||||||
|
* A link to a place to action this
|
||||||
|
*
|
||||||
|
* @return action_link|null
|
||||||
|
*/
|
||||||
|
public function get_action_link(): ?\action_link {
|
||||||
|
return new \action_link(
|
||||||
new \moodle_url('/admin/settings.php?section=frontpagesettings#admin-defaultfrontpageroleid'),
|
new \moodle_url('/admin/settings.php?section=frontpagesettings#admin-defaultfrontpageroleid'),
|
||||||
get_string('frontpagesettings', 'admin'));
|
get_string('frontpagesettings', 'admin'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,13 +41,21 @@ use core\check\result;
|
||||||
class guestrole extends check {
|
class guestrole extends check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Get the short check name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_name(): string {
|
||||||
|
return get_string('check_guestrole_name', 'report_security');
|
||||||
|
}
|
||||||
|
|
||||||
$this->id = 'guestrole';
|
/**
|
||||||
$this->name = get_string('check_guestrole_name', 'report_security');
|
* A link to a place to action this
|
||||||
$this->actionlink = new \action_link(
|
*
|
||||||
|
* @return action_link|null
|
||||||
|
*/
|
||||||
|
public function get_action_link(): ?\action_link {
|
||||||
|
return new \action_link(
|
||||||
new \moodle_url('/admin/settings.php?section=userpolicies'),
|
new \moodle_url('/admin/settings.php?section=userpolicies'),
|
||||||
get_string('userpolicies', 'admin'));
|
get_string('userpolicies', 'admin'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,12 +41,21 @@ use core\check\result;
|
||||||
class riskadmin extends check {
|
class riskadmin extends check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Get the short check name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_name(): string {
|
||||||
$this->id = 'riskadmin';
|
return get_string('check_riskadmin_name', 'report_security');
|
||||||
$this->name = get_string('check_riskadmin_name', 'report_security');
|
}
|
||||||
$this->actionlink = new \action_link(
|
|
||||||
|
/**
|
||||||
|
* A link to a place to action this
|
||||||
|
*
|
||||||
|
* @return action_link|null
|
||||||
|
*/
|
||||||
|
public function get_action_link(): ?\action_link {
|
||||||
|
return new \action_link(
|
||||||
new \moodle_url('/admin/roles/admins.php'),
|
new \moodle_url('/admin/roles/admins.php'),
|
||||||
get_string('siteadministrators', 'role'));
|
get_string('siteadministrators', 'role'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,13 +39,21 @@ use core\check\result;
|
||||||
class riskbackup extends check {
|
class riskbackup extends check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Get the short check name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_name(): string {
|
||||||
|
return get_string('check_riskbackup_name', 'report_security');
|
||||||
|
}
|
||||||
|
|
||||||
$this->id = 'riskbackup';
|
/**
|
||||||
$this->name = get_string('check_riskbackup_name', 'report_security');
|
* A link to a place to action this
|
||||||
$this->actionlink = new \action_link(
|
*
|
||||||
|
* @return action_link|null
|
||||||
|
*/
|
||||||
|
public function get_action_link(): ?\action_link {
|
||||||
|
return new \action_link(
|
||||||
new \moodle_url('/admin/roles/manage.php'),
|
new \moodle_url('/admin/roles/manage.php'),
|
||||||
get_string('manageroles', 'role'));
|
get_string('manageroles', 'role'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,13 +46,21 @@ use core\check\result;
|
||||||
class riskxss extends \core\check\check {
|
class riskxss extends \core\check\check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Get the short check name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_name(): string {
|
||||||
|
return get_string('check_riskxss_name', 'report_security');
|
||||||
|
}
|
||||||
|
|
||||||
$this->id = 'riskxss';
|
/**
|
||||||
$this->name = get_string('check_riskxss_name', 'report_security');
|
* A link to a place to action this
|
||||||
$this->actionlink = new \action_link(
|
*
|
||||||
|
* @return action_link|null
|
||||||
|
*/
|
||||||
|
public function get_action_link(): ?\action_link {
|
||||||
|
return new \action_link(
|
||||||
new \moodle_url('/admin/roles/manage.php'),
|
new \moodle_url('/admin/roles/manage.php'),
|
||||||
get_string('manageroles', 'role'));
|
get_string('manageroles', 'role'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,21 +41,6 @@ abstract class check {
|
||||||
*/
|
*/
|
||||||
protected $component = 'core';
|
protected $component = 'core';
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string $id - Should be unique identifier within a component.
|
|
||||||
*/
|
|
||||||
protected $id = '';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string $name - Name for the check, should be the same regardless of state.
|
|
||||||
*/
|
|
||||||
protected $name = '';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var action_link - an optional link to a place to address the check.
|
|
||||||
*/
|
|
||||||
protected $actionlink = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the frankenstyle component name
|
* Get the frankenstyle component name
|
||||||
*
|
*
|
||||||
|
@ -77,10 +62,16 @@ abstract class check {
|
||||||
/**
|
/**
|
||||||
* Get the check's id
|
* Get the check's id
|
||||||
*
|
*
|
||||||
* @return string must be unique for it's component
|
* This defaults to the base name of the class which is ok in the most
|
||||||
|
* cases but if you have a check which can have multiple instances then
|
||||||
|
* you should override this to be unique.
|
||||||
|
*
|
||||||
|
* @return string must be unique within a component
|
||||||
*/
|
*/
|
||||||
public function get_id(): string {
|
public function get_id(): string {
|
||||||
return $this->id;
|
$class = get_class($this);
|
||||||
|
$id = explode("\\", $class);
|
||||||
|
return end($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -103,7 +94,8 @@ abstract class check {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_name(): string {
|
public function get_name(): string {
|
||||||
return $this->name;
|
$id = $this->get_id();
|
||||||
|
return get_string("check{$id}", $this->get_component());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -112,7 +104,7 @@ abstract class check {
|
||||||
* @return action_link|null
|
* @return action_link|null
|
||||||
*/
|
*/
|
||||||
public function get_action_link(): ?\action_link {
|
public function get_action_link(): ?\action_link {
|
||||||
return $this->actionlink;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -41,12 +41,12 @@ use core\check\result;
|
||||||
class configrw extends check {
|
class configrw extends check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Get the short check name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_name(): string {
|
||||||
global $CFG;
|
return get_string('check_configrw_name', 'report_security');
|
||||||
$this->id = 'configrw';
|
|
||||||
$this->name = get_string('check_configrw_name', 'report_security');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -47,12 +47,12 @@ use core\check\check;
|
||||||
class displayerrors extends check {
|
class displayerrors extends check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Get the short check name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_name(): string {
|
||||||
|
return get_string('check_displayerrors_name', 'report_security');
|
||||||
$this->id = 'displayerrors';
|
|
||||||
$this->name = get_string('check_displayerrors_name', 'report_security');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -41,12 +41,12 @@ use core\check\result;
|
||||||
class nodemodules extends check {
|
class nodemodules extends check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Get the short check name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_name(): string {
|
||||||
global $CFG;
|
return get_string('check_nodemodules_name', 'report_security');
|
||||||
$this->id = 'nodemodules';
|
|
||||||
$this->name = get_string('check_nodemodules_name', 'report_security');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -41,13 +41,12 @@ use core\check\result;
|
||||||
class preventexecpath extends check {
|
class preventexecpath extends check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Get the short check name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_name(): string {
|
||||||
|
return get_string('check_preventexecpath_name', 'report_security');
|
||||||
global $CFG;
|
|
||||||
$this->id = 'preventexecpath';
|
|
||||||
$this->name = get_string('check_preventexecpath_name', 'report_security');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,14 +40,12 @@ use core\check\result;
|
||||||
class unsecuredataroot extends \core\check\check {
|
class unsecuredataroot extends \core\check\check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Get the short check name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_name(): string {
|
||||||
|
return get_string('check_unsecuredataroot_name', 'report_security');
|
||||||
global $CFG;
|
|
||||||
|
|
||||||
$this->id = 'unsecuredataroot';
|
|
||||||
$this->name = get_string('check_unsecuredataroot_name', 'report_security');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -41,12 +41,12 @@ use core\check\result;
|
||||||
class vendordir extends check {
|
class vendordir extends check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Get the short check name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_name(): string {
|
||||||
global $CFG;
|
return get_string('check_vendordir_name', 'report_security');
|
||||||
$this->id = 'vendordir';
|
|
||||||
$this->name = get_string('check_vendordir_name', 'report_security');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -45,13 +45,21 @@ use core\check\result;
|
||||||
class cookiesecure extends check {
|
class cookiesecure extends check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Get the short check name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_name(): string {
|
||||||
|
return get_string('check_cookiesecure_name', 'report_security');
|
||||||
|
}
|
||||||
|
|
||||||
$this->id = 'cookiesecure';
|
/**
|
||||||
$this->name = get_string('check_cookiesecure_name', 'report_security');
|
* A link to a place to action this
|
||||||
$this->actionlink = new \action_link(
|
*
|
||||||
|
* @return action_link|null
|
||||||
|
*/
|
||||||
|
public function get_action_link(): ?\action_link {
|
||||||
|
return new \action_link(
|
||||||
new \moodle_url('/admin/settings.php?section=httpsecurity#admin-cookiesecure'),
|
new \moodle_url('/admin/settings.php?section=httpsecurity#admin-cookiesecure'),
|
||||||
get_string('httpsecurity', 'admin'));
|
get_string('httpsecurity', 'admin'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,13 +47,21 @@ use core\check\result;
|
||||||
class crawlers extends check {
|
class crawlers extends check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Get the short check name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_name(): string {
|
||||||
|
return get_string('check_crawlers_name', 'report_security');
|
||||||
|
}
|
||||||
|
|
||||||
$this->id = 'crawlers';
|
/**
|
||||||
$this->name = get_string('check_crawlers_name', 'report_security');
|
* A link to a place to action this
|
||||||
$this->actionlink = new \action_link(
|
*
|
||||||
|
* @return action_link|null
|
||||||
|
*/
|
||||||
|
public function get_action_link(): ?\action_link {
|
||||||
|
return new \action_link(
|
||||||
new \moodle_url('/admin/settings.php?section=sitepolicies#admin-opentowebcrawlers'),
|
new \moodle_url('/admin/settings.php?section=sitepolicies#admin-opentowebcrawlers'),
|
||||||
get_string('sitepolicies', 'admin'));
|
get_string('sitepolicies', 'admin'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,12 +41,21 @@ use core\check\result;
|
||||||
class emailchangeconfirmation extends check {
|
class emailchangeconfirmation extends check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Get the short check name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_name(): string {
|
||||||
$this->id = 'emailchangeconfirmation';
|
return get_string('check_emailchangeconfirmation_name', 'report_security');
|
||||||
$this->name = get_string('check_emailchangeconfirmation_name', 'report_security');
|
}
|
||||||
$this->actionlink = new \action_link(
|
|
||||||
|
/**
|
||||||
|
* A link to a place to action this
|
||||||
|
*
|
||||||
|
* @return action_link|null
|
||||||
|
*/
|
||||||
|
public function get_action_link(): ?\action_link {
|
||||||
|
return new \action_link(
|
||||||
new \moodle_url('/admin/settings.php?section=sitepolicies#admin-emailchangeconfirmation'),
|
new \moodle_url('/admin/settings.php?section=sitepolicies#admin-emailchangeconfirmation'),
|
||||||
get_string('sitepolicies', 'admin'));
|
get_string('sitepolicies', 'admin'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,12 +41,21 @@ use core\check\result;
|
||||||
class embed extends check {
|
class embed extends check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Get the short check name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_name(): string {
|
||||||
$this->id = 'embed';
|
return get_string('check_embed_name', 'report_security');
|
||||||
$this->name = get_string('check_embed_name', 'report_security');
|
}
|
||||||
$this->actionlink = new \action_link(
|
|
||||||
|
/**
|
||||||
|
* A link to a place to action this
|
||||||
|
*
|
||||||
|
* @return action_link|null
|
||||||
|
*/
|
||||||
|
public function get_action_link(): ?\action_link {
|
||||||
|
return new \action_link(
|
||||||
new \moodle_url('/admin/settings.php?section=sitepolicies#admin-allowobjectembed'),
|
new \moodle_url('/admin/settings.php?section=sitepolicies#admin-allowobjectembed'),
|
||||||
get_string('sitepolicies', 'admin'));
|
get_string('sitepolicies', 'admin'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,13 +41,21 @@ use core\check\result;
|
||||||
class mediafilterswf extends check {
|
class mediafilterswf extends check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Get the short check name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_name(): string {
|
||||||
global $CFG;
|
return get_string('check_mediafilterswf_name', 'report_security');
|
||||||
$this->id = 'mediafilterswf';
|
}
|
||||||
$this->name = get_string('check_mediafilterswf_name', 'report_security');
|
|
||||||
$this->actionlink = new \action_link(
|
/**
|
||||||
|
* A link to a place to action this
|
||||||
|
*
|
||||||
|
* @return action_link|null
|
||||||
|
*/
|
||||||
|
public function get_action_link(): ?\action_link {
|
||||||
|
return new \action_link(
|
||||||
new \moodle_url('/admin/settings.php?section=managemediaplayers'),
|
new \moodle_url('/admin/settings.php?section=managemediaplayers'),
|
||||||
get_string('managemediaplayers', 'media'));
|
get_string('managemediaplayers', 'media'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,13 +41,21 @@ use core\check\result;
|
||||||
class openprofiles extends check {
|
class openprofiles extends check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Get the short check name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_name(): string {
|
||||||
|
return get_string('check_openprofiles_name', 'report_security');
|
||||||
|
}
|
||||||
|
|
||||||
$this->id = 'openprofiles';
|
/**
|
||||||
$this->name = get_string('check_openprofiles_name', 'report_security');
|
* A link to a place to action this
|
||||||
$this->actionlink = new \action_link(
|
*
|
||||||
|
* @return action_link|null
|
||||||
|
*/
|
||||||
|
public function get_action_link(): ?\action_link {
|
||||||
|
return new \action_link(
|
||||||
new \moodle_url('/admin/settings.php?section=sitepolicies#admin-forcelogin'),
|
new \moodle_url('/admin/settings.php?section=sitepolicies#admin-forcelogin'),
|
||||||
get_string('sitepolicies', 'admin'));
|
get_string('sitepolicies', 'admin'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,12 +41,21 @@ use core\check\result;
|
||||||
class passwordpolicy extends check {
|
class passwordpolicy extends check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Get the short check name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_name(): string {
|
||||||
$this->id = 'passwordpolicy';
|
return get_string('check_passwordpolicy_name', 'report_security');
|
||||||
$this->name = get_string('check_passwordpolicy_name', 'report_security');
|
}
|
||||||
$this->actionlink = new \action_link(
|
|
||||||
|
/**
|
||||||
|
* A link to a place to action this
|
||||||
|
*
|
||||||
|
* @return action_link|null
|
||||||
|
*/
|
||||||
|
public function get_action_link(): ?\action_link {
|
||||||
|
return new \action_link(
|
||||||
new \moodle_url('/admin/settings.php?section=sitepolicies#admin-passwordpolicy'),
|
new \moodle_url('/admin/settings.php?section=sitepolicies#admin-passwordpolicy'),
|
||||||
get_string('sitepolicies', 'admin'));
|
get_string('sitepolicies', 'admin'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,14 +41,23 @@ use core\check\result;
|
||||||
class webcron extends check {
|
class webcron extends check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Get the short check name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function get_name(): string {
|
||||||
$this->id = 'webcron';
|
return get_string('check_webcron_name', 'report_security');
|
||||||
$this->name = get_string('check_webcron_name', 'report_security');
|
}
|
||||||
$this->actionlink = new \action_link(
|
|
||||||
new \moodle_url('/admin/settings.php?section=sitepolicies#admin-cronclionly'),
|
/**
|
||||||
get_string('sitepolicies', 'admin'));
|
* A link to a place to action this
|
||||||
|
*
|
||||||
|
* @return action_link|null
|
||||||
|
*/
|
||||||
|
public function get_action_link(): ?\action_link {
|
||||||
|
return new \action_link(
|
||||||
|
new \moodle_url('/admin/settings.php?section=sitepolicies#admin-cronclionly'),
|
||||||
|
get_string('sitepolicies', 'admin'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1687,7 +1687,7 @@ class core_renderer extends renderer_base {
|
||||||
* @param result $result
|
* @param result $result
|
||||||
* @return string HTML fragment
|
* @return string HTML fragment
|
||||||
*/
|
*/
|
||||||
protected function render_result(core\check\result $result) {
|
protected function render_check_result(core\check\result $result) {
|
||||||
return $this->render_from_template($result->get_template_name(), $result->export_for_template($this));
|
return $this->render_from_template($result->get_template_name(), $result->export_for_template($this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1697,8 +1697,8 @@ class core_renderer extends renderer_base {
|
||||||
* @param result $result
|
* @param result $result
|
||||||
* @return string HTML fragment
|
* @return string HTML fragment
|
||||||
*/
|
*/
|
||||||
public function result(core\check\result $result) {
|
public function check_result(core\check\result $result) {
|
||||||
return $this->render_result($result);
|
return $this->render_check_result($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -87,7 +87,7 @@ foreach ($checks as $check) {
|
||||||
$link = new \moodle_url('/report/security/index.php', ['detail' => $ref]);
|
$link = new \moodle_url('/report/security/index.php', ['detail' => $ref]);
|
||||||
|
|
||||||
$row = [];
|
$row = [];
|
||||||
$row[] = $OUTPUT->result($result);
|
$row[] = $OUTPUT->check_result($result);
|
||||||
$row[] = $OUTPUT->action_link($link, $check->get_name());
|
$row[] = $OUTPUT->action_link($link, $check->get_name());
|
||||||
|
|
||||||
$row[] = $result->get_summary();
|
$row[] = $result->get_summary();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue