-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1134 from UniversityRadioYork/data-protection-is-…
…probably-a-good-idea-yes GDPR compliance: - adds privacy policy that must be signed on log in - adds ability for users to hide their profile or have it hidden by management - adds scripts for gdpr deletion
- Loading branch information
Showing
11 changed files
with
541 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CREATE TYPE deletion AS ENUM ('default', 'informed', 'optout', 'deleted'); | ||
|
||
ALTER TABLE Public.member | ||
ADD data_removal deletion DEFAULT('default'); | ||
|
||
ALTER TABLE Public.member | ||
ADD hide_profile boolean DEFAULT(false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/local/bin/php -q | ||
<?php | ||
/** | ||
* DO NOT RUN THIS SCRIPT WILLY NILLY | ||
* this script will delete the personal data of any members that have been emailed regarding deletion and have not acted | ||
* you should probably run the gdpremail script first then wait a week or two | ||
* | ||
* run with "php gdprdeleteall.php" | ||
*/ | ||
|
||
use \MyRadio\Database; | ||
use \MyRadio\MyRadioException; | ||
use \MyRadio\MyRadioError; | ||
use \MyRadio\MyRadioEmail; | ||
use \MyRadio\MyRadio\CoreUtils; | ||
use \MyRadio\ServiceAPI\MyRadio_User; | ||
|
||
ini_set('log_errors', 1); | ||
ini_set('error_log', '/tmp/php-gdpr-deleteall.log'); | ||
ini_set('display_errors', 'On'); | ||
|
||
require_once '../src/Controllers/root_cli.php'; | ||
|
||
$db = Database::getInstance(); | ||
|
||
$time = strtotime("-1 year", time()); | ||
$date = date("Y-m-d", $time); | ||
|
||
echo "This script will delete details of all users that have not logged in for over a year\n Are you sure you want to continue? (y/n)"; | ||
$cmdinput = trim(fgets(STDIN)); | ||
if($cmdinput != 'Y'){ | ||
return; | ||
} | ||
echo "deleting user data\n"; | ||
|
||
$db->query( | ||
'UPDATE public.member | ||
SET data_removal=\'default\' | ||
WHERE data_removal=\'informed\' and last_login >= $1 ', | ||
[$date] | ||
); | ||
|
||
$db->query( | ||
'UPDATE public.member | ||
SET college=10, phone=DEFAULT, receive_email=false, endofcourse=DEFAULT, wheelchair=DEFAULT, data_removal=\'deleted\' | ||
WHERE data_removal=\'informed\'', | ||
[] | ||
); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
#!/usr/local/bin/php -q | ||
<?php | ||
/** | ||
* DO NOT RUN THIS SCRIPT WILLY NILLY | ||
* This script will completely yoink a users personal details, show credits, podcast credits and a bunch of other stuff. | ||
* Only run this script if a user has explicity declared they wish to be forgotten and understand the consequences. | ||
* | ||
* run with "php gdprdeleteuser.php [userid]" | ||
*/ | ||
|
||
use \MyRadio\Database; | ||
use \MyRadio\MyRadioException; | ||
use \MyRadio\MyRadioError; | ||
use \MyRadio\MyRadioEmail; | ||
use \MyRadio\MyRadio\CoreUtils; | ||
use \MyRadio\ServiceAPI\MyRadio_User; | ||
|
||
ini_set('log_errors', 1); | ||
ini_set('error_log', '/tmp/php-gdpr-deleteuser.log'); | ||
ini_set('display_errors', 'On'); | ||
|
||
require_once '../src/Controllers/root_cli.php'; | ||
|
||
$db = Database::getInstance(); | ||
|
||
$time = strtotime("-1 year", time()); | ||
$date = date("Y-m-d", $time); | ||
|
||
$deletedUserId = 1350883; | ||
|
||
$userid = $argv[1]; | ||
|
||
echo "This script will delete all the users personal data and some database links to the user\n Are you sure you want to continue? (y/n)"; | ||
$cmdinput = trim(fgets(STDIN)); | ||
if($cmdinput != 'Y'){ | ||
return; | ||
} | ||
echo "User selected for deletion: " . $userid . "\n"; | ||
|
||
try{ | ||
$db->query( | ||
'INSERT INTO public.member( | ||
memberid, fname, sname, college, receive_email, data_removal) | ||
VALUES ($1, \'deleted\', \'user\', 10, false, \'deleted\')', | ||
[$deletedUserId] | ||
); | ||
} catch (exception $e) { | ||
echo 'deleting user\n'; | ||
} | ||
|
||
$db->query( | ||
'UPDATE schedule.show_credit SET memberid=$1 WHERE memberid=$2', | ||
[$deletedUserId,$userid] | ||
); | ||
|
||
$db->query( | ||
'UPDATE uryplayer.podcast_credit SET creditid=$1 WHERE creditid=$2', | ||
[$deletedUserId,$userid] | ||
); | ||
|
||
$db->query( | ||
'UPDATE bapsplanner.managed_items SET memberid=$1 WHERE memberid=$2', | ||
[$deletedUserId,$userid] | ||
); | ||
|
||
$db->query( | ||
'UPDATE schedule.timeslot_metadata SET memberid=$1 WHERE memberid=$2', | ||
[$deletedUserId,$userid] | ||
); | ||
|
||
$db->query( | ||
'UPDATE public.mail_alias_member SET memberid=$1 WHERE memberid=$2', | ||
[$deletedUserId,$userid] | ||
); | ||
|
||
$db->query( | ||
'UPDATE public.member_year SET memberid=$1 WHERE memberid=$2', | ||
[$deletedUserId,$userid] | ||
); | ||
|
||
$db->query( | ||
'UPDATE public.member_presenterstatus SET memberid=$1 WHERE memberid=$2', | ||
[$deletedUserId,$userid] | ||
); | ||
|
||
$db->query( | ||
'UPDATE public.member_pass SET memberid=$1 WHERE memberid=$2', | ||
[$deletedUserId,$userid] | ||
); | ||
|
||
$db->query( | ||
'UPDATE uryplayer.podcast_metadata SET memberid=$1 WHERE memberid=$2', | ||
[$deletedUserId,$userid] | ||
); | ||
|
||
$db->query( | ||
'UPDATE mail.email_recipient_member SET memberid=$1 WHERE memberid=$2', | ||
[$deletedUserId,$userid] | ||
); | ||
|
||
$db->query( | ||
'UPDATE uryplayer.podcast SET memberid=$1 WHERE memberid=$2', | ||
[$deletedUserId,$userid] | ||
); | ||
|
||
$db->query( | ||
'UPDATE public.mail_subscription SET memberid=$1 WHERE memberid=$2', | ||
[$deletedUserId,$userid] | ||
); | ||
|
||
$db->query( | ||
'UPDATE mail.alias_member SET destination=$1 WHERE destination=$2', | ||
[$deletedUserId,$userid] | ||
); | ||
|
||
$db->query( | ||
'UPDATE public.member | ||
SET college=10, phone=DEFAULT, email=DEFAULT, receive_email=false, local_name=DEFAULT, local_alias=DEFAULT, account_locked=true, last_login=DEFAULT, endofcourse=DEFAULT, eduroam=DEFAULT, usesmtppassword=DEFAULT, joined=DEFAULT, require_password_change=DEFAUlT, profile_photo=DEFAULT, bio=DEFAULT, auth_provider=DEFAULT, contract_signed=DEFAULT, gdpr_accepted=DEFAULT, wheelchair=DEFAULT, data_removal=\'deleted\' | ||
WHERE memberid=$1', | ||
[$deletedUserId,$userid] | ||
); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/usr/local/bin/php -q | ||
<?php | ||
/** | ||
* DO NOT RUN THIS SCRIPT WILLY NILLY | ||
* this script will email literally everyone that has not logged into myradio in over a year. That is a lot of people. | ||
* after running this and waiting a couple weeks you should probably run the gdprdelete script | ||
* | ||
* run with "php gdpremail.php" | ||
* | ||
* Not actually tested for obvious reasons but probably works | ||
*/ | ||
|
||
use \MyRadio\Database; | ||
use \MyRadio\MyRadioException; | ||
use \MyRadio\MyRadioError; | ||
use \MyRadio\MyRadioEmail; | ||
use \MyRadio\MyRadio\CoreUtils; | ||
use \MyRadio\ServiceAPI\MyRadio_User; | ||
|
||
ini_set('log_errors', 1); | ||
ini_set('error_log', '/tmp/php-gdpr-email.log'); | ||
ini_set('display_errors', 'On'); | ||
|
||
require_once '../src/Controllers/root_cli.php'; | ||
|
||
$db = Database::getInstance(); | ||
|
||
$warning_email = <<<EOT | ||
<p>You are getting this email because you have not logged into MyRadio in over a year</p> | ||
<p>In one week all of your personally identifiable data that is not required for webstudio or our public facing websites to function as advertised will be deleted.</p> | ||
<p>If you wish to avoid this you can opt out of deletion by logging into your <a href="https://ury.org.uk/myradio">myradio account or by contact the ury computing team.</p> | ||
<p>If you are happy for your personal data to be deleted feel free to ignore this eamil.</p> | ||
--<br/> | ||
The URY Computing team<br/> | ||
<br/> | ||
University Radio York 1350AM 88.3FM<br/> | ||
---------------------------------------------<br/> | ||
<a href="mailto:[email protected]">[email protected]</a><br/> | ||
---------------------------------------------<br/> | ||
On Air | Online | On Tap<br/> | ||
<a href="https://ury.org.uk">ury.org.uk</a> | ||
EOT; | ||
|
||
$time = strtotime("-1 year", time()); | ||
$date = date("Y-m-d", $time); | ||
|
||
echo "This script will Email all users that have not logged in for over a year\n Are you sure you want to continue? (y/n)"; | ||
$cmdinput = trim(fgets(STDIN)); | ||
if($cmdinput != 'Y'){ | ||
return; | ||
} | ||
echo "Emailing users\n"; | ||
|
||
$memebersToEmail = $db->fetchAll( | ||
'SELECT memberid, last_login | ||
FROM public.member WHERE last_login <= $1 and joined <= $1', | ||
[$date] | ||
); | ||
|
||
$db->query( | ||
'UPDATE public.member | ||
SET data_removal=\'informed\' | ||
WHERE data_removal=\'default\' and last_login <= $1 and joined <= $1', | ||
[$date] | ||
); | ||
|
||
$db->query( | ||
'UPDATE public.member | ||
SET data_removal=\'informed\' | ||
WHERE data_removal=\'default\' and last_login IS NULL', | ||
[] | ||
); | ||
|
||
foreach($memebersToEmail as $member){ | ||
MyRadioEmail::sendEmailToUser( | ||
$member["memberid"], | ||
'MyRadio account deletion', | ||
$warning_email | ||
); | ||
} | ||
?> |
Oops, something went wrong.