Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-67776

Allow plugins to add security checks

    XMLWordPrintable

Details

    • MDL-67776-security-check-callback
    • Hide

      1) Add a new callback to 

      /mod/assign/lib.php

      function mod_assign_security_checks() {
          return [new mod_assign\check\foobar()];
      }
      

      And make a new check class in mod/assign/classes/check/foobar.php

      <?php
      namespace mod_assign\check;
      use core\check\check;
       
      class foobar extends check {
          public function __construct() {
              $this->id = 'foobar';
              $this->name = 'my foobar check';
              $this->status = check::ERROR;
              $this->summary = 'foobar summary';
              $this->details = 'some <b>details!</b>';
          }
      }
      

      2) Purge cache

      php admin/cli/purge_caches.php

      3) Visit /report/security/index.php

      Confirm you can see a new 'foobar' check which is failing

      4) Click on the Foo bar link and confirm you can see the details

      Show
      1) Add a new callback to  /mod/assign/lib.php function mod_assign_security_checks() { return [ new mod_assign\check\foobar()]; } And make a new check class in mod/assign/classes/check/foobar.php <?php namespace mod_assign\check; use core\check\check;   class foobar extends check { public function __construct() { $this ->id = 'foobar' ; $this ->name = 'my foobar check' ; $this ->status = check::ERROR; $this ->summary = 'foobar summary' ; $this ->details = 'some <b>details!</b>' ; } } 2) Purge cache php admin/cli/purge_caches.php 3) Visit /report/security/index.php Confirm you can see a new 'foobar' check which is failing 4) Click on the Foo bar link and confirm you can see the details

    Description

      ie add a callback to augment: report_security_get_issue_list()

       

      Attachments

        Issue Links

          Activity

            People

              brendanheywood Brendan Heywood
              brendanheywood Brendan Heywood
              Peter Burnett Peter Burnett
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: