Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.
   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   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_communication\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   * Privacy Subsystem for core_communication implementing null_provider.
  27   *
  28   * @package    core_communication
  29   * @copyright  2023 Huong Nguyen <huongnv13@gmail.com>
  30   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  31   */
  32  class provider implements
  33      \core_privacy\local\request\core_userlist_provider,
  34      \core_privacy\local\metadata\provider,
  35      \core_privacy\local\request\subsystem\provider {
  36      public static function get_metadata(collection $collection): collection {
  37  
  38          $collection->add_database_table('communication_user', [
  39              'commid' => 'privacy:metadata:communication_user:commid',
  40              'userid' => 'privacy:metadata:communication_user:userid',
  41              'synced' => 'privacy:metadata:communication_user:synced',
  42          ], 'privacy:metadata:communication_user');
  43  
  44          return $collection;
  45      }
  46  
  47      public static function get_contexts_for_userid(int $userid): contextlist {
  48          return new contextlist();
  49      }
  50  
  51      public static function export_user_data(approved_contextlist $contextlist) {
  52          // None of the core communication tables should be exported.
  53      }
  54  
  55      public static function delete_data_for_all_users_in_context(\context $context) {
  56          // None of the data from these tables should be deleted.
  57      }
  58  
  59      public static function delete_data_for_user(approved_contextlist $contextlist) {
  60          // None of the data from these tables should be deleted.
  61      }
  62  
  63      public static function get_users_in_context(userlist $userlist) {
  64          // Don't add any users.
  65      }
  66  
  67      public static function delete_data_for_users(approved_userlist $userlist) {
  68          // None of the data from these tables should be deleted.
  69      }
  70  }