Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are 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   * Privacy class for requesting user data.
  18   *
  19   * @package    message_jabber
  20   * @copyright  2018 Mihail Geshoski <mihail@moodle.com>
  21   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  22   */
  23  
  24  namespace message_jabber\privacy;
  25  
  26  defined('MOODLE_INTERNAL') || die();
  27  
  28  use \core_privacy\local\metadata\collection;
  29  use \core_privacy\local\request\contextlist;
  30  use \core_privacy\local\request\approved_contextlist;
  31  use core_privacy\local\request\userlist;
  32  use \core_privacy\local\request\approved_userlist;
  33  
  34  /**
  35   * Privacy class for requesting user data.
  36   *
  37   * @package    message_jabber
  38   * @copyright  2018 Mihail Geshoski <mihail@moodle.com>
  39   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  40   */
  41  class provider implements
  42          \core_privacy\local\metadata\provider,
  43          \core_privacy\local\request\core_userlist_provider,
  44          \core_privacy\local\request\plugin\provider {
  45  
  46      /**
  47       * Returns meta data about this system.
  48       *
  49       * @param   collection $collection The initialised collection to add items to.
  50       * @return  collection A listing of user data stored through this system.
  51       */
  52      public static function get_metadata(collection $collection) : collection {
  53          $collection->link_external_location('External Jabber server.', [
  54              'userto' => 'privacy:metadata:userto',
  55              'userfrom' => 'privacy:metadata:userfrom',
  56              'smallmessage' => 'privacy:metadata:smallmessage',
  57              'contexturl' => 'privacy:metadata:contexturl',
  58          ], 'privacy:metadata:externalpurpose');
  59          return $collection;
  60      }
  61  
  62      /**
  63       * Get the list of contexts that contain user information for the specified user.
  64       *
  65       * @param   int         $userid     The user to search.
  66       * @return  contextlist The contextlist containing the list of contexts used in this plugin.
  67       */
  68      public static function get_contexts_for_userid(int $userid) : contextlist {
  69          return new contextlist();
  70      }
  71  
  72      /**
  73       * Get the list of users who have data within a context.
  74       *
  75       * @param   userlist    $userlist   The userlist containing the list of users who have data in this context/plugin combination.
  76       */
  77      public static function get_users_in_context(userlist $userlist) {
  78      }
  79  
  80      /**
  81       * Export all user data for the specified user, in the specified contexts.
  82       *
  83       * @param approved_contextlist $contextlist The approved contexts to export information for.
  84       */
  85      public static function export_user_data(approved_contextlist $contextlist) {
  86      }
  87  
  88      /**
  89       * Delete all use data which matches the specified deletion_criteria.
  90       *
  91       * @param   context $context A user context.
  92       */
  93      public static function delete_data_for_all_users_in_context(\context $context) {
  94      }
  95  
  96      /**
  97       * Delete multiple users within a single context.
  98       *
  99       * @param   approved_userlist       $userlist The approved context and user information to delete information for.
 100       */
 101      public static function delete_data_for_users(approved_userlist $userlist) {
 102      }
 103  
 104      /**
 105       * Delete all user data for the specified user, in the specified contexts.
 106       *
 107       * @param   approved_contextlist    $contextlist    The approved contexts and user information to delete information for.
 108       */
 109      public static function delete_data_for_user(approved_contextlist $contextlist) {
 110      }
 111  }