Skip to content

Commit

Permalink
Privacy
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Oct 24, 2023
1 parent 0f2ec16 commit b1e385e
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 13 deletions.
92 changes: 80 additions & 12 deletions classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,96 @@
*
* The squared theme makes uses a custom version of squared blocks
*
* @package theme_squared
* @copyright 2019 onwards Onlinecampus Virtuelle PH
* Provider class file. As required for any data privacy information required.
*
* @package theme_squared
* @copyright 2019 onwards Onlinecampus Virtuelle PH
* www.virtuelle-ph.at, David Bogner www.edulabs.org
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @copyright 2023 G J Barnard.
* @author G J Barnard -
* {@link https://moodle.org/user/profile.php?id=442195}
* {@link https://gjbarnard.co.uk}
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/

namespace theme_squared\privacy;

use core_privacy\local\request\writer;
use core_privacy\local\metadata\collection;

/**
* The Squared theme does not store any user data.
* But if you use CDN fonts then investigate the respective privacy policies.
* Privacy provider.
*/
class provider implements \core_privacy\local\metadata\null_provider {
class provider implements
// This plugin has data.
\core_privacy\local\metadata\provider,

// This plugin has some sitewide user preferences to export.
\core_privacy\local\request\user_preference_provider {

/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
* Returns meta data about this system.
*
* @return string
* @param collection $items The initialised item collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_reason() : string {
return 'privacy:nop';
public static function get_metadata(collection $items): collection {
$items->add_user_preference('drawer-open-index', 'privacy:metadata:preference:draweropenindex');
$items->add_user_preference('drawer-open-block', 'privacy:metadata:preference:draweropenblock');
$items->add_user_preference('theme_squared_zoom', 'privacy:metadata:preference:themesquaredzoom');
return $items;
}

/**
* Store all user preferences for the plugin.
*
* @param int $userid The user id of the user whose data is to be exported.
*/
public static function export_user_preferences(int $userid) {
$preferences = get_user_preferences(null, null, $userid);
foreach ($preferences as $name => $value) {
$blockid = null;
$matches = [];
if ($name == 'drawer-open-index') {
$decoded = ($value) ? get_string('privacy:open', 'theme_squared') : get_string('privacy:closed', 'theme_squared');

writer::export_user_preference(
'theme_squared',
$name,
$value,
get_string('privacy:request:preference:draweropenindex', 'theme_squared', (object) [
'name' => $name,
'value' => $value,
'decoded' => $decoded,
])
);
} else if ($name == 'drawer-open-block') {
$decoded = ($value) ? get_string('privacy:open', 'theme_squared') : get_string('privacy:closed', 'theme_squared');

writer::export_user_preference(
'theme_squared',
$name,
$value,
get_string('privacy:request:preference:draweropenblock', 'theme_squared', (object) [
'name' => $name,
'value' => $value,
'decoded' => $decoded,
])
);
} else if ($name == 'theme_squared_zoom') {
$decoded = get_string('privacy:'.$value, 'theme_squared');

writer::export_user_preference(
'theme_squared',
$name,
$value,
get_string('privacy:request:preference:themesquaredzoom', 'theme_squared', (object) [
'name' => $name,
'value' => $value,
'decoded' => $decoded,
])
);
}
}
}
}
13 changes: 12 additions & 1 deletion lang/en/theme_squared.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,15 @@
$string['footnotedesc'] = 'Whatever you add to this html area will be displayed in the footer throughout your Moodle site.';

// Privacy.
$string['privacy:nop'] = 'The Squared theme stores lots of settings that pertain to its configuration. None of the settings are related to a specific user. It is your responsibilty to ensure that no user data is entered in any of the free text fields. Setting a setting will result in that action being logged within the core Moodle logging system against the user whom changed it, this is outside of the themes control, please see the core logging system for privacy compliance for this. When uploading images, you should avoid uploading images with embedded location data (EXIF GPS) included or other such personal data. It would be possible to extract any location / personal data from the images. If you use CDN fonts then investigate their respective privacy policies. Please examine the code carefully to be sure that it complies with your interpretation of your privacy laws. I am not a lawyer and my analysis is based on my interpretation. If you have any doubt then remove the theme forthwith.';
$string['privacy:note'] = 'The Squared theme stores has settings that pertain to its configuration. It also may inherit settings and user preferences from the parent Boost theme, please examine the \'Plugin privacy compliance registry\' for \'Boost\' for details. For the settings, it is your responsibility to ensure that no user data is entered in any of the free text fields. Setting a setting will result in that action being logged within the core Moodle logging system against the user whom changed it, this is outside of the themes control, please see the core logging system for privacy compliance for this. When uploading images, you should avoid uploading images with embedded location data (EXIF GPS) included or other such personal data. It would be possible to extract any location / personal data from the images. Please examine the code carefully to be sure that it complies with your interpretation of your privacy laws. I am not a lawyer and my analysis is based on my interpretation. If you have any doubt then remove the theme forthwith.';
$string['privacy:closed'] = 'Closed';
$string['privacy:open'] = 'Open';
$string['privacy:nozoom'] = 'No zoom';
$string['privacy:zoomin'] = 'Zoomed in';
$string['privacy:metadata:preference:draweropenindex'] = 'The state of the course index.';
$string['privacy:request:preference:draweropenindex'] = 'The user preference "{$a->name}" has the value "{$a->value}" which represents "{$a->decoded}" for the state of the course index.';
$string['privacy:metadata:preference:draweropenblock'] = 'The state of the block drawer.';
$string['privacy:request:preference:draweropenblock'] = 'The user preference "{$a->name}" has the value "{$a->value}" which represents "{$a->decoded}" for the state of the block drawer.';
$string['privacy:metadata:preference:themesquaredzoom'] = 'The state of the zoom.';
$string['privacy:request:preference:themesquaredzoom'] = 'The user preference "{$a->name}" has the value "{$a->value}" which represents "{$a->decoded}" for the state of the zoom.';

1 change: 1 addition & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
// Page general settings.
$settings = new theme_boost_admin_settingspage_tabs('themesettingsquared', get_string('pluginname', 'theme_squared'));
$sp = new admin_settingpage('theme_squared_basic', get_string('basicsettings', 'theme_squared'));
$sp->add(new admin_setting_heading('theme_squared_privacy', '', get_string('privacy:note', 'theme_squared')));
$simset = new squared_simple_theme_settings($sp, 'theme_squared');

// Custom favicon.
Expand Down

0 comments on commit b1e385e

Please sign in to comment.