Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 401 and 402] [Versions 401 and 403]

   1  <?php
   2  // This file is part of The Course Module Navigation Block
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  namespace core_adminpresets\privacy;
  18  
  19  use core_privacy\local\metadata\collection;
  20  use core_privacy\local\request\approved_contextlist;
  21  use core_privacy\local\request\approved_userlist;
  22  use core_privacy\local\request\contextlist;
  23  use core_privacy\local\request\userlist;
  24  
  25  /**
  26   * Admin presets this file handle privacy provider.
  27   *
  28   * @package          core_adminpresets
  29   * @copyright        2021 Pimenko <support@pimenko.com><pimenko.com>
  30   * @author           Jordan Kesraoui | Sylvain Revenu | Pimenko based on David MonllaĆ³ <david.monllao@urv.cat> code
  31   * @license          http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  32   */
  33  class provider implements
  34          \core_privacy\local\metadata\provider,
  35          \core_privacy\local\request\subsystem\provider,
  36          \core_privacy\local\request\core_userlist_provider {
  37  
  38      /**
  39       * Returns information about the user data stored in this component.
  40       *
  41       * @param  collection $collection A list of information about this component
  42       * @return collection The collection object filled out with information about this component.
  43       */
  44      public static function get_metadata(collection $collection) : collection {
  45          // These tables are really data about site configuration and not user data.
  46  
  47          // The adminpresets includes information about which user performed a configuration change using the admin_presets
  48          // tool.
  49          // This is not considered to be user data.
  50          $collection->add_database_table('adminpresets', [
  51                  'userid'        => 'privacy:metadata:adminpresets:userid',
  52                  'name'          => 'privacy:metadata:adminpresets:name',
  53                  'comments'      => 'privacy:metadata:adminpresets:comments',
  54                  'site'          => 'privacy:metadata:adminpresets:site',
  55                  'moodlerelease' => 'privacy:metadata:adminpresets:moodlerelease',
  56                  'timecreated'   => 'privacy:metadata:adminpresets:timecreated',
  57              ], 'privacy:metadata:adminpresets');
  58  
  59          // The adminpresets_app includes information about which user performed configuration change using the admin_presets
  60          // tool.
  61          // This is not considered to be user data.
  62          $collection->add_database_table('adminpresets_app', [
  63                  'adminpresetid' => 'privacy:metadata:adminpresets_app:adminpresetid',
  64                  'userid'        => 'privacy:metadata:adminpresets_app:userid',
  65                  'time'          => 'privacy:metadata:adminpresets_app:time',
  66              ], 'privacy:metadata:adminpresets_app');
  67  
  68          return $collection;
  69      }
  70  
  71      /**
  72       * Get the list of contexts that contain user information for the specified user.
  73       *
  74       * @param   int $userid The user to search.
  75       * @return  contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
  76       */
  77      public static function get_contexts_for_userid(int $userid) : contextlist {
  78          return new contextlist();
  79      }
  80  
  81      /**
  82       * Get the list of users who have data within a context.
  83       *
  84       * @param   userlist    $userlist   The userlist containing the list of users who have data in this context/plugin combination.
  85       */
  86      public static function get_users_in_context(userlist $userlist) {
  87          // Don't add any user.
  88      }
  89  
  90      /**
  91       * Export all user data for the specified user, in the specified contexts.
  92       *
  93       * @param approved_contextlist $contextlist The approved contexts to export information for.
  94       */
  95      public static function export_user_data(approved_contextlist $contextlist) {
  96          // None of the core tables should be exported.
  97      }
  98  
  99      /**
 100       * Delete all data for all users in the specified context.
 101       *
 102       * @param context $context The specific context to delete data for.
 103       */
 104      public static function delete_data_for_all_users_in_context(\context $context) {
 105          // None of the the data from these tables should be deleted.
 106      }
 107  
 108      /**
 109       * Delete all user data for the specified user, in the specified contexts.
 110       *
 111       * @param approved_contextlist $contextlist The approved contexts and user information to delete information for.
 112       */
 113      public static function delete_data_for_user(approved_contextlist $contextlist) {
 114          // None of the the data from these tables should be deleted.
 115      }
 116  
 117      /**
 118       * Delete multiple users within a single context.
 119       *
 120       * @param   approved_userlist       $userlist The approved context and user information to delete information for.
 121       */
 122      public static function delete_data_for_users(approved_userlist $userlist) {
 123          // None of the the data from these tables should be deleted.
 124      }
 125  }