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

Allow plugins to add security checks

    XMLWordPrintable

    Details

    • Testing Instructions:
      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
    • Pull Master Branch:
      MDL-67776-security-check-callback

      Description

      ie add a callback to augment: report_security_get_issue_list()

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              brendanheywood Brendan Heywood
              Reporter:
              brendanheywood Brendan Heywood
              Peer reviewer:
              Peter Burnett
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: