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

Allow plugins to add security checks

XMLWordPrintable

    • 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

      ie add a callback to augment: report_security_get_issue_list()

       

            brendanheywood Brendan Heywood
            brendanheywood Brendan Heywood
            Peter Burnett Peter Burnett
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.