summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2010-10-31 19:29:29 -0400
committerJeremy Kerr <jk@ozlabs.org>2011-04-14 17:21:04 +0800
commitc2c6a408c7764fa29389ce160f52776c9308d50a (patch)
tree1c47388b5494210aeed87f56f0c8b6e9fbeb4633 /lib
parent56e2243f3be7e859666ce0e4e1a8b8b94444f8d4 (diff)
downloadpatchwork-c2c6a408c7764fa29389ce160f52776c9308d50a.tar
patchwork-c2c6a408c7764fa29389ce160f52776c9308d50a.tar.gz
registration: use EmailConfimation rather than separate registration app
Since we have infrastructure for email confirmations, we no longer need the separate registration app. Requires a migration script, which will delete all inactive users, including those newly added and pending confirmation. Use carefully. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/sql/grant-all.mysql.sql1
-rw-r--r--lib/sql/grant-all.postgres.sql6
-rw-r--r--lib/sql/migration/009-drop-registrationprofile.sql27
3 files changed, 29 insertions, 5 deletions
diff --git a/lib/sql/grant-all.mysql.sql b/lib/sql/grant-all.mysql.sql
index f60c6b8..a3d758c 100644
--- a/lib/sql/grant-all.mysql.sql
+++ b/lib/sql/grant-all.mysql.sql
@@ -22,7 +22,6 @@ GRANT SELECT, UPDATE, INSERT, DELETE ON patchwork_project TO 'www-data'@localhos
GRANT SELECT, UPDATE, INSERT, DELETE ON patchwork_bundle TO 'www-data'@localhost;
GRANT SELECT, UPDATE, INSERT, DELETE ON patchwork_bundle_patches TO 'www-data'@localhost;
GRANT SELECT, UPDATE, INSERT, DELETE ON patchwork_patch TO 'www-data'@localhost;
-GRANT SELECT, UPDATE, INSERT, DELETE ON registration_registrationprofile TO 'www-data'@localhost;
-- allow the mail user (in this case, 'nobody') to add patches
GRANT INSERT, SELECT ON patchwork_patch TO 'nobody'@localhost;
diff --git a/lib/sql/grant-all.postgres.sql b/lib/sql/grant-all.postgres.sql
index 47c4ad3..591ffd0 100644
--- a/lib/sql/grant-all.postgres.sql
+++ b/lib/sql/grant-all.postgres.sql
@@ -22,8 +22,7 @@ GRANT SELECT, UPDATE, INSERT, DELETE ON
patchwork_project,
patchwork_bundle,
patchwork_bundlepatch,
- patchwork_patch,
- registration_registrationprofile
+ patchwork_patch
TO "www-data";
GRANT SELECT, UPDATE ON
auth_group_id_seq,
@@ -45,8 +44,7 @@ GRANT SELECT, UPDATE ON
patchwork_state_id_seq,
patchwork_emailconfirmation_id_seq,
patchwork_userprofile_id_seq,
- patchwork_userprofile_maintainer_projects_id_seq,
- registration_registrationprofile_id_seq
+ patchwork_userprofile_maintainer_projects_id_seq
TO "www-data";
-- allow the mail user (in this case, 'nobody') to add patches
diff --git a/lib/sql/migration/009-drop-registrationprofile.sql b/lib/sql/migration/009-drop-registrationprofile.sql
new file mode 100644
index 0000000..f1c2b43
--- /dev/null
+++ b/lib/sql/migration/009-drop-registrationprofile.sql
@@ -0,0 +1,27 @@
+BEGIN;
+
+DELETE FROM registration_registrationprofile;
+
+-- unlink users who have contributed
+
+UPDATE patchwork_person SET user_id = NULL
+ WHERE user_id IN (SELECT id FROM auth_user WHERE is_active = False)
+ AND id IN (SELECT DISTINCT submitter_id FROM patchwork_comment);
+
+-- remove persons who only have a user linkage
+
+DELETE FROM patchwork_person WHERE user_id IN
+ (SELECT id FROM auth_user WHERE is_active = False);
+
+-- delete profiles
+
+DELETE FROM patchwork_userprofile WHERE user_id IN
+ (SELECT id FROM auth_user WHERE is_active = False);
+
+-- delete inactive users
+
+DELETE FROM auth_user WHERE is_active = False;
+
+DROP TABLE registration_registrationprofile;
+
+COMMIT;