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.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403] [Versions 39 and 310]

   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  /**
  18   * Privacy class for requesting user data.
  19   *
  20   * @package    message_email
  21   * @copyright  2018 Mihail Geshoski <mihail@moodle.com>
  22   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  namespace message_email\privacy;
  26  
  27  defined('MOODLE_INTERNAL') || die();
  28  
  29  use \core_privacy\local\metadata\collection;
  30  use \core_privacy\local\request\contextlist;
  31  use \core_privacy\local\request\approved_contextlist;
  32  use core_privacy\local\request\userlist;
  33  use \core_privacy\local\request\approved_userlist;
  34  
  35  /**
  36   * Privacy class for requesting user data.
  37   *
  38   * @package    message_email
  39   * @copyright  2018 Mihail Geshoski <mihail@moodle.com>
  40   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  41   */
  42  class provider implements
  43          \core_privacy\local\metadata\provider,
  44          \core_privacy\local\request\core_userlist_provider,
  45          \core_privacy\local\request\plugin\provider {
  46  
  47      /**
  48       * Returns meta data about this system.
  49       *
  50       * @param   collection $collection The initialised collection to add items to.
  51       * @return  collection A listing of user data stored through this system.
  52       */
  53      public static function get_metadata(collection $collection) : collection {
  54          $messageemailmessages = [
  55              'useridto' => 'privacy:metadata:message_email_messages:useridto',
  56              'conversationid' => 'privacy:metadata:message_email_messages:conversationid',
  57              'messageid' => 'privacy:metadata:message_email_messages:messageid',
  58          ];
  59          // Note - this data gets deleted once the scheduled task runs.
  60          $collection->add_database_table('message_email_messages',
  61              $messageemailmessages, 'privacy:metadata:message_email_messages');
  62  
  63          $collection->link_external_location('smtp', [
  64                  'recipient' => 'privacy:metadata:recipient',
  65                  'userfrom' => 'privacy:metadata:userfrom',
  66                  'subject' => 'privacy:metadata:subject',
  67                  'fullmessage' => 'privacy:metadata:fullmessage',
  68                  'fullmessagehtml' => 'privacy:metadata:fullmessagehtml',
  69                  'attachment' => 'privacy:metadata:attachment',
  70                  'attachname' => 'privacy:metadata:attachname',
  71                  'replyto' => 'privacy:metadata:replyto',
  72                  'replytoname' => 'privacy:metadata:replytoname'
  73          ], 'privacy:metadata:externalpurpose');
  74  
  75          return $collection;
  76      }
  77  
  78      /**
  79       * Get the list of contexts that contain user information for the specified user.
  80       *
  81       * @param   int         $userid     The user to search.
  82       * @return  contextlist $contextlist  The contextlist containing the list of contexts used in this plugin.
  83       */
  84      public static function get_contexts_for_userid(int $userid) : contextlist {
  85          $contextlist = new contextlist();
  86          return $contextlist;
  87      }
  88  
  89      /**
  90       * Get the list of users who have data within a context.
  91       *
  92       * @param   userlist    $userlist   The userlist containing the list of users who have data in this context/plugin combination.
  93       */
  94      public static function get_users_in_context(userlist $userlist) {
  95      }
  96  
  97      /**
  98       * Export all user data for the specified user, in the specified contexts.
  99       *
 100       * @param approved_contextlist $contextlist The approved contexts to export information for.
 101       */
 102      public static function export_user_data(approved_contextlist $contextlist) {
 103      }
 104  
 105      /**
 106       * Delete all use data which matches the specified deletion_criteria.
 107       *
 108       * @param   context $context A user context.
 109       */
 110      public static function delete_data_for_all_users_in_context(\context $context) {
 111      }
 112  
 113      /**
 114       * Delete multiple users within a single context.
 115       *
 116       * @param   approved_userlist       $userlist The approved context and user information to delete information for.
 117       */
 118      public static function delete_data_for_users(approved_userlist $userlist) {
 119      }
 120  
 121      /**
 122       * Delete all user data for the specified user, in the specified contexts.
 123       *
 124       * @param   approved_contextlist    $contextlist    The approved contexts and user information to delete information for.
 125       */
 126      public static function delete_data_for_user(approved_contextlist $contextlist) {
 127      }
 128  }