Merge lp:~jml/launchpad/techboard-celebrity into lp:launchpad/db-devel

Proposed by Jonathan Lange
Status: Merged
Approved by: Deryck Hodge
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~jml/launchpad/techboard-celebrity
Merge into: lp:launchpad/db-devel
Diff against target: None lines
To merge this branch: bzr merge lp:~jml/launchpad/techboard-celebrity
Reviewer Review Type Date Requested Status
Deryck Hodge (community) code Approve
Review via email: mp+9636@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jonathan Lange (jml) wrote :

Currently, the Launchpad codebase has hardcoded references to the 'techboard' team in its code. It has code that looks up the team and raises errors if it isn't found. All of this is wrong.

We have a well-defined way of using well-known objects: celebrities. This branch updates the code to have a celebrity called ubuntu_techboard and updates the sampledata to guarantee its existence. It then updates the security checker and the tests to work with the new celebrity.

I've also updated the sampledata documentation based on my experiences here, as well as the https://dev.launchpad.net/AddingLaunchpadCelebrities page.

This branch depends on the sampledata branch that I recently had reviewed. This will appear as changes to database/schema/Makefile. These changes can be safely ignored.

Revision history for this message
Deryck Hodge (deryck) wrote :

Looks good to me, Jono.

I will point out for the sake of completeness should someone else come along, that the link you mention in your initial comment on this MP is, I believe, meant to be this link:

https://dev.launchpad.net/AddingLaunchpadCelebrity

Cheers,
deryck

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'database/sampledata/README'
2--- database/sampledata/README 2008-11-13 12:45:38 +0000
3+++ database/sampledata/README 2009-08-04 11:02:12 +0000
4@@ -38,7 +38,7 @@
5
6 make
7
8- 3. Connect to the db, and then do any INSERT or UPDATE commands you need:
9+ 3a. Connect to the db, and then do any INSERT or UPDATE commands you need:
10
11 psql -d launchpad_dev -f my_sample_data_mods.sql
12
13@@ -48,6 +48,15 @@
14
15 If there are errors, fix and start again.
16
17+ 3b. Alternatively, use 'make harness' to connect to the database and use
18+ any APIs you need:
19+
20+ make harness
21+
22+ Or:
23+
24+ make harness LPCONFIG=test-playground
25+
26 4. Make a fresh snapshot of the sample data to newsampledata.sql:
27
28 make newsampledata
29
30=== modified file 'database/sampledata/current-dev.sql'
31--- database/sampledata/current-dev.sql 2009-07-29 08:42:49 +0000
32+++ database/sampledata/current-dev.sql 2009-08-04 10:53:35 +0000
33@@ -1,5 +1,5 @@
34--- Copyright 2009 Canonical Ltd. This software is licensed under the
35--- GNU Affero General Public License version 3 (see the file LICENSE).
36+--- Copyright 2009 Canonical Ltd. This software is licensed under the
37+--- GNU Affero General Public License version 3 (see the file LICENSE).
38
39 SET check_function_bodies = false;
40 SET client_encoding = 'UTF8';
41@@ -813,6 +813,7 @@
42 INSERT INTO account (id, date_created, creation_rationale, status, date_status_set, displayname, openid_identifier, status_comment, old_openid_identifier) VALUES (243623, '2008-06-27 14:49:11.149508', 8, 20, '2008-06-27 14:49:11.149508', 'Brad Crittenden', 'mTmeENb', NULL, NULL);
43 INSERT INTO account (id, date_created, creation_rationale, status, date_status_set, displayname, openid_identifier, status_comment, old_openid_identifier) VALUES (243624, '2008-11-04 12:59:26.965843', 8, 20, '2008-11-04 13:09:43.807125', 'PPA key guard', 'cF4PNk3', NULL, '771/ppa-key-guard');
44 INSERT INTO account (id, date_created, creation_rationale, status, date_status_set, displayname, openid_identifier, status_comment, old_openid_identifier) VALUES (243625, '2009-03-17 07:28:15.948042', 1, 20, '2009-03-17 07:28:15.948042', 'Ubuntu-branches-owner', '3sbtGMy', 'Activated when the preferred email was set.', '538/ubuntu-branches-owner');
45+INSERT INTO account (id, date_created, creation_rationale, status, date_status_set, displayname, openid_identifier, status_comment, old_openid_identifier) VALUES (243626, '2009-08-04 10:49:59.788665', 1, 20, '2009-08-04 10:49:59.788665', 'Techboard Owner', 'LQCGF4D', 'Activated when the preferred email was set.', NULL);
46
47
48 ALTER TABLE account ENABLE TRIGGER ALL;
49@@ -2380,6 +2381,7 @@
50 INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (79, 'admin@canonical.com', 16, 2, '2008-08-05 12:01:32.086327', 16);
51 INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (80, 'ubuntu-branches-owner@example.com', 243627, 4, '2009-03-17 07:28:15.948042', 243625);
52 INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (81, 'guadamen@lists.launchpad.dev', 32, 4, '2009-06-24 00:34:34.490304', NULL);
53+INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (82, 'techboard-owner@example.com', 243631, 4, '2009-08-04 10:49:59.788665', 243626);
54
55
56 ALTER TABLE emailaddress ENABLE TRIGGER ALL;
57@@ -4761,6 +4763,8 @@
58 INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243628, 'Ubuntu branches', 243627, 'Celebrity team that controls Ubuntu source package branches.', 'ubuntu-branches', NULL, NULL, NULL, NULL, 3, NULL, '2009-03-17 07:29:13.259033', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL);
59 INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243629, 'Ubuntu Security Team', 4, NULL, 'ubuntu-security', NULL, NULL, NULL, NULL, 2, NULL, '2009-07-14 20:23:59.698654', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL);
60 INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243630, 'HWDB Team', 16, NULL, 'hwdb-team', NULL, NULL, NULL, NULL, 3, NULL, '2009-07-09 09:12:39.400351', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL);
61+INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243631, 'Techboard Owner', NULL, NULL, 'techboard-owner', NULL, NULL, NULL, NULL, 1, NULL, '2009-08-04 10:49:59.775114', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, true, 1, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, 243626);
62+INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243632, 'Ubuntu Technical Board', 243631, NULL, 'techboard', NULL, NULL, NULL, NULL, 3, NULL, '2009-08-04 10:50:07.351252', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL);
63
64
65 ALTER TABLE person ENABLE TRIGGER ALL;
66@@ -9164,6 +9168,7 @@
67 INSERT INTO teammembership (id, person, team, status, date_joined, date_expires, last_changed_by, last_change_comment, proposed_by, acknowledged_by, reviewed_by, date_proposed, date_last_changed, date_acknowledged, date_reviewed, proponent_comment, acknowledger_comment, reviewer_comment, date_created) VALUES (101, 243617, 243630, 2, '2009-07-09 11:58:46.481813', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-09 11:58:46.481813');
68 INSERT INTO teammembership (id, person, team, status, date_joined, date_expires, last_changed_by, last_change_comment, proposed_by, acknowledged_by, reviewed_by, date_proposed, date_last_changed, date_acknowledged, date_reviewed, proponent_comment, acknowledger_comment, reviewer_comment, date_created) VALUES (102, 243622, 243630, 2, '2009-07-09 11:58:46.481813', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-09 11:58:46.481813');
69 INSERT INTO teammembership (id, person, team, status, date_joined, date_expires, last_changed_by, last_change_comment, proposed_by, acknowledged_by, reviewed_by, date_proposed, date_last_changed, date_acknowledged, date_reviewed, proponent_comment, acknowledger_comment, reviewer_comment, date_created) VALUES (103, 243623, 243630, 2, '2009-07-09 11:58:46.481813', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-09 11:58:46.481813');
70+INSERT INTO teammembership (id, person, team, status, date_joined, date_expires, last_changed_by, last_change_comment, proposed_by, acknowledged_by, reviewed_by, date_proposed, date_last_changed, date_acknowledged, date_reviewed, proponent_comment, acknowledger_comment, reviewer_comment, date_created) VALUES (104, 243631, 243632, 3, '2009-08-04 10:50:10.056772', NULL, NULL, NULL, 243631, NULL, 243631, '2009-08-04 10:50:10.056772', NULL, NULL, '2009-08-04 10:50:10.056772', NULL, NULL, NULL, '2009-08-04 10:50:07.351252');
71
72
73 ALTER TABLE teammembership ENABLE TRIGGER ALL;
74@@ -9366,6 +9371,9 @@
75 INSERT INTO teamparticipation (id, team, person) VALUES (214, 243630, 243617);
76 INSERT INTO teamparticipation (id, team, person) VALUES (215, 243630, 243622);
77 INSERT INTO teamparticipation (id, team, person) VALUES (216, 243630, 243623);
78+INSERT INTO teamparticipation (id, team, person) VALUES (217, 243631, 243631);
79+INSERT INTO teamparticipation (id, team, person) VALUES (218, 243632, 243632);
80+INSERT INTO teamparticipation (id, team, person) VALUES (219, 243632, 243631);
81
82
83 ALTER TABLE teamparticipation ENABLE TRIGGER ALL;
84
85=== modified file 'database/sampledata/current.sql'
86--- database/sampledata/current.sql 2009-07-28 20:39:25 +0000
87+++ database/sampledata/current.sql 2009-08-04 10:53:35 +0000
88@@ -1,5 +1,5 @@
89--- Copyright 2009 Canonical Ltd. This software is licensed under the
90--- GNU Affero General Public License version 3 (see the file LICENSE).
91+--- Copyright 2009 Canonical Ltd. This software is licensed under the
92+--- GNU Affero General Public License version 3 (see the file LICENSE).
93
94 SET check_function_bodies = false;
95 SET client_encoding = 'UTF8';
96@@ -813,6 +813,7 @@
97 INSERT INTO account (id, date_created, creation_rationale, status, date_status_set, displayname, openid_identifier, status_comment, old_openid_identifier) VALUES (2436231, '2008-06-27 14:49:11.149508', 8, 20, '2008-06-27 14:49:11.149508', 'Brad Crittenden', 'mTmeENb', NULL, NULL);
98 INSERT INTO account (id, date_created, creation_rationale, status, date_status_set, displayname, openid_identifier, status_comment, old_openid_identifier) VALUES (2436241, '2008-11-04 12:59:26.965843', 8, 20, '2008-11-04 13:09:43.807125', 'PPA key guard', 'cF4PNk3', NULL, '771/ppa-key-guard');
99 INSERT INTO account (id, date_created, creation_rationale, status, date_status_set, displayname, openid_identifier, status_comment, old_openid_identifier) VALUES (2436242, '2009-03-17 07:26:14.024613', 1, 20, '2009-03-17 07:26:14.024613', 'Ubuntu-branches-owner', 'GMX7shE', 'Activated when the preferred email was set.', '359/ubuntu-branches-owner');
100+INSERT INTO account (id, date_created, creation_rationale, status, date_status_set, displayname, openid_identifier, status_comment, old_openid_identifier) VALUES (2436243, '2009-08-04 10:50:39.383407', 1, 20, '2009-08-04 10:50:39.383407', 'Techboard Owner', 'kYFxQYP', 'Activated when the preferred email was set.', NULL);
101
102
103 ALTER TABLE account ENABLE TRIGGER ALL;
104@@ -2382,6 +2383,7 @@
105 INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (79, 'admin@canonical.com', 16, 2, '2008-08-05 12:01:32.086327', 161);
106 INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (80, 'ppa-key-guard@launchpad.net', 243625, 4, '2008-11-04 12:59:26.965843', 2436241);
107 INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (81, 'ubuntu-branches-owner@example.com', 243627, 4, '2009-03-17 07:26:14.024613', 2436242);
108+INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (82, 'techboard-owner@example.com', 243631, 4, '2009-08-04 10:50:39.383407', 2436243);
109
110
111 ALTER TABLE emailaddress ENABLE TRIGGER ALL;
112@@ -4756,6 +4758,8 @@
113 INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243628, 'Ubuntu branches', 243627, 'Celebrity team that controls official source package branches.', 'ubuntu-branches', NULL, NULL, NULL, NULL, 3, NULL, '2009-03-17 07:27:39.306182', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL);
114 INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243629, 'Ubuntu Security Team', 4, NULL, 'ubuntu-security', NULL, NULL, NULL, NULL, 2, NULL, '2009-07-14 20:23:59.698654', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL);
115 INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243630, 'HWDB Team', 16, NULL, 'hwdb-team', NULL, NULL, NULL, NULL, 3, NULL, '2009-07-09 09:12:39.400351', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL);
116+INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243631, 'Techboard Owner', NULL, NULL, 'techboard-owner', NULL, NULL, NULL, NULL, 1, NULL, '2009-08-04 10:50:39.370018', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, true, 1, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, 2436243);
117+INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243632, 'Ubuntu Technical Board', 243631, NULL, 'techboard', NULL, NULL, NULL, NULL, 3, NULL, '2009-08-04 10:50:39.370018', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL);
118
119
120 ALTER TABLE person ENABLE TRIGGER ALL;
121@@ -9158,6 +9162,7 @@
122 INSERT INTO teammembership (id, person, team, status, date_joined, date_expires, last_changed_by, last_change_comment, proposed_by, acknowledged_by, reviewed_by, date_proposed, date_last_changed, date_acknowledged, date_reviewed, proponent_comment, acknowledger_comment, reviewer_comment, date_created) VALUES (102, 243617, 243630, 2, '2009-07-09 11:58:38.122886', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-09 11:58:38.122886');
123 INSERT INTO teammembership (id, person, team, status, date_joined, date_expires, last_changed_by, last_change_comment, proposed_by, acknowledged_by, reviewed_by, date_proposed, date_last_changed, date_acknowledged, date_reviewed, proponent_comment, acknowledger_comment, reviewer_comment, date_created) VALUES (103, 243622, 243630, 2, '2009-07-09 11:58:38.122886', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-09 11:58:38.122886');
124 INSERT INTO teammembership (id, person, team, status, date_joined, date_expires, last_changed_by, last_change_comment, proposed_by, acknowledged_by, reviewed_by, date_proposed, date_last_changed, date_acknowledged, date_reviewed, proponent_comment, acknowledger_comment, reviewer_comment, date_created) VALUES (104, 243623, 243630, 2, '2009-07-09 11:58:38.122886', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2009-07-09 11:58:38.122886');
125+INSERT INTO teammembership (id, person, team, status, date_joined, date_expires, last_changed_by, last_change_comment, proposed_by, acknowledged_by, reviewed_by, date_proposed, date_last_changed, date_acknowledged, date_reviewed, proponent_comment, acknowledger_comment, reviewer_comment, date_created) VALUES (105, 243631, 243632, 3, '2009-08-04 10:50:47.920683', NULL, NULL, NULL, 243631, NULL, 243631, '2009-08-04 10:50:47.920683', NULL, NULL, '2009-08-04 10:50:47.920683', NULL, NULL, NULL, '2009-08-04 10:50:39.370018');
126
127
128 ALTER TABLE teammembership ENABLE TRIGGER ALL;
129@@ -9365,6 +9370,9 @@
130 INSERT INTO teamparticipation (id, team, person) VALUES (217, 243630, 243617);
131 INSERT INTO teamparticipation (id, team, person) VALUES (218, 243630, 243622);
132 INSERT INTO teamparticipation (id, team, person) VALUES (219, 243630, 243623);
133+INSERT INTO teamparticipation (id, team, person) VALUES (220, 243631, 243631);
134+INSERT INTO teamparticipation (id, team, person) VALUES (221, 243632, 243632);
135+INSERT INTO teamparticipation (id, team, person) VALUES (222, 243632, 243631);
136
137
138 ALTER TABLE teamparticipation ENABLE TRIGGER ALL;
139
140=== modified file 'database/schema/Makefile'
141--- database/schema/Makefile 2009-07-13 03:05:37 +0000
142+++ database/schema/Makefile 2009-08-04 10:13:01 +0000
143@@ -42,14 +42,20 @@
144 # The command we use to drop (if exists) and recreate a database.
145 CREATEDB=${PYTHON} ../../utilities/pgmassacre.py -t
146
147+HEADER="--- Copyright 2009 Canonical Ltd. This software is licensed under \
148+ the\n--- GNU Affero General Public License version 3 (see the file \
149+ LICENSE)."
150+
151 # The command used (in conjunction with $(call)) to dump the contents of the
152 # given database ($1) into an SQL file ($2).
153 build_new_sampledata=$(PYTHON) fti.py --null -d ${1} -q; \
154+ echo $(HEADER) > $(2); \
155 pg_dump --schema=public --disable-triggers -a -D -O -d ${1} \
156 | grep -v "\( TOC \|INSERT INTO launchpaddatabaserevision \|sessiondata\|sessionpkgdata\|SELECT pg_catalog\.setval\|^--\| fticache \|'fticache'\|ALTER TABLE secret\|INSERT INTO secret\)" \
157- | $(PYTHON) sort_sql.py > $(2); \
158+ | $(PYTHON) sort_sql.py >> $(2); \
159 $(PYTHON) fti.py --force -d ${1} -q
160
161+
162 # The latest schema dump from production. Database patches are relative
163 # to this baseline. This dump should be updated every production rollout
164 # to ensure that the development database remains in sync with reality
165@@ -186,5 +192,5 @@
166 $(call build_new_sampledata,${TEMPLATE_WITH_TEST_SAMPLEDATA},${LINTDATA})
167 $(call build_new_sampledata,${TEMPLATE_WITH_DEV_SAMPLEDATA},${LINTDATA_DEV})
168
169-.PHONY: default base all
170+.PHONY: default test dev create check search_path all doc diagram newsampledata_test newsampledata_dev newsampledata lintdata
171
172
173=== modified file 'lib/canonical/launchpad/doc/celebrities.txt'
174--- lib/canonical/launchpad/doc/celebrities.txt 2009-07-15 02:58:08 +0000
175+++ lib/canonical/launchpad/doc/celebrities.txt 2009-08-04 10:53:57 +0000
176@@ -1,6 +1,6 @@
177 = Launchpad Celebrities =
178
179-https://launchpad.canonical.com/LaunchpadCelebrities
180+https://dev.launchpad.net/LaunchpadCelebrities
181
182 There are a number of special objects, some of which exist in the
183 database, which we want to give easy access to in the code. To this end,
184@@ -211,3 +211,15 @@
185 >>> ubuntu_security = personset.getByName('ubuntu-security')
186 >>> celebs.ubuntu_security == ubuntu_security
187 True
188+
189+
190+== Ubuntu technical board ==
191+
192+There's a celebrity for the Ubuntu technical board, the 'techboard' team. It's
193+used for determining who is allowed to create new package sets.
194+
195+ >>> ubuntu_techboard = personset.getByName('techboard')
196+ >>> print ubuntu_techboard.name
197+ techboard
198+ >>> celebs.ubuntu_techboard == ubuntu_techboard
199+ True
200
201=== modified file 'lib/canonical/launchpad/interfaces/launchpad.py'
202--- lib/canonical/launchpad/interfaces/launchpad.py 2009-07-27 18:22:07 +0000
203+++ lib/canonical/launchpad/interfaces/launchpad.py 2009-08-04 10:53:57 +0000
204@@ -130,6 +130,7 @@
205 ubuntu_bugzilla = Attribute("The Ubuntu Bugzilla.")
206 ubuntu_cdimage_mirror = Attribute("The main cdimage mirror for Ubuntu.")
207 ubuntu_security = Attribute("The 'ubuntu-security' team.")
208+ ubuntu_techboard = Attribute("The Ubuntu technical board.")
209 vcs_imports = Attribute("The 'vcs-imports' team.")
210
211
212
213=== modified file 'lib/canonical/launchpad/security.py'
214--- lib/canonical/launchpad/security.py 2009-07-31 02:45:01 +0000
215+++ lib/canonical/launchpad/security.py 2009-08-04 11:53:27 +0000
216@@ -2181,20 +2181,9 @@
217 def checkAuthenticated(self, user):
218 """Users must be an admin or a member of the tech board."""
219 celebrities = getUtility(ILaunchpadCelebrities)
220- if user.inTeam(celebrities.admin):
221- return True
222-
223- techboard = getUtility(IPersonSet).getByName("techboard")
224- if techboard is None:
225- # We expect techboard to be present but it's not. Log an
226- # OOPS.
227- error = AssertionError(
228- "'techboard' team is missing, has it been renamed?")
229- info = (error.__class__, error, None)
230- globalErrorUtility = getUtility(IErrorReportingUtility)
231- globalErrorUtility.raising(info)
232- return False
233- return user.inTeam(techboard)
234+ return (
235+ user.inTeam(celebrities.admin)
236+ or user.inTeam(celebrities.ubuntu_techboard))
237
238
239 class LinkOfficialSourcePackageBranches(AuthorizationBase):
240
241=== modified file 'lib/canonical/launchpad/utilities/celebrities.py'
242--- lib/canonical/launchpad/utilities/celebrities.py 2009-07-19 04:41:14 +0000
243+++ lib/canonical/launchpad/utilities/celebrities.py 2009-08-04 10:53:57 +0000
244@@ -137,6 +137,7 @@
245 ubuntu_branches = CelebrityDescriptor(IPersonSet, 'ubuntu-branches')
246 ubuntu_bugzilla = CelebrityDescriptor(IBugTrackerSet, 'ubuntu-bugzilla')
247 ubuntu_security = CelebrityDescriptor(IPersonSet, 'ubuntu-security')
248+ ubuntu_techboard = CelebrityDescriptor(IPersonSet, 'techboard')
249 vcs_imports = CelebrityDescriptor(IPersonSet, 'vcs-imports')
250
251 @property
252
253=== modified file 'lib/lp/soyuz/doc/archivepermission.txt'
254--- lib/lp/soyuz/doc/archivepermission.txt 2009-07-27 19:39:31 +0000
255+++ lib/lp/soyuz/doc/archivepermission.txt 2009-08-04 11:53:27 +0000
256@@ -267,6 +267,7 @@
257 Set up a helper function to check access:
258
259 >>> from zope.security.checker import canAccess
260+ >>> from zope.security.proxy import removeSecurityProxy
261 >>> restricted_methods = (
262 ... 'newPackageUploader', 'newComponentUploader', 'newQueueAdmin',
263 ... 'deletePackageUploader', 'deleteComponentUploader',
264@@ -274,30 +275,14 @@
265 >>> def checkAccess(true_or_false):
266 ... for method in restricted_methods:
267 ... assert(canAccess(permission_set, method) == true_or_false)
268-
269-If, for some reason, the techboard team is missing, the security adapter
270-will not allow access and generates an OOPS.
271-
272- >>> login("test@canonical.com")
273- >>> from zope.app.error.interfaces import IErrorReportingUtility
274- >>> report = getUtility(IErrorReportingUtility).getLastOopsReport()
275- >>> checkAccess(False)
276- >>> report2 = getUtility(IErrorReportingUtility).getLastOopsReport()
277- >>> print report.id == report2.id
278- False
279- >>> print report2.value
280- 'techboard' team is missing, has it been renamed?
281-
282-Set up the techboard team:
283-
284- >>> login("foo.bar@canonical.com")
285- >>> from canonical.launchpad.interfaces import (
286- ... IPersonSet, TeamSubscriptionPolicy)
287+ >>> from canonical.launchpad.interfaces.launchpad import (
288+ ... ILaunchpadCelebrities)
289+ >>> from lp.registry.interfaces.person import IPersonSet
290+ >>> from lp.registry.interfaces.teammembership import (
291+ ... TeamMembershipStatus)
292 >>> personset = getUtility(IPersonSet)
293- >>> owner = personset.getByName("name16")
294- >>> techboard = personset.newTeam(
295- ... owner, "techboard", "techboard",
296- ... subscriptionpolicy=TeamSubscriptionPolicy.OPEN)
297+ >>> techboard = getUtility(ILaunchpadCelebrities).ubuntu_techboard
298+ >>> techboard = removeSecurityProxy(techboard)
299
300 Ordinary users have no access:
301
302@@ -312,7 +297,9 @@
303 Now add "test@canonical.com" to the techboard team and log in as him.
304
305 >>> person = personset.getByEmail("test@canonical.com")
306- >>> person.join(techboard)
307+ >>> techboard.addMember(
308+ ... person, reviewer=person, status=TeamMembershipStatus.APPROVED,
309+ ... force_team_add=True)
310 >>> login_person(person)
311
312 newPackageUploader() creates a permission for a person to upload to a
313
314=== modified file 'lib/lp/soyuz/doc/packageset.txt'
315--- lib/lp/soyuz/doc/packageset.txt 2009-07-27 19:39:31 +0000
316+++ lib/lp/soyuz/doc/packageset.txt 2009-08-04 11:53:27 +0000
317@@ -557,32 +557,15 @@
318 (Ubuntu Technical Board) team.
319
320 >>> from zope.security.checker import canAccess
321+ >>> from zope.security.proxy import removeSecurityProxy
322+ >>> from canonical.launchpad.interfaces.launchpad import (
323+ ... ILaunchpadCelebrities)
324+ >>> from lp.registry.interfaces.person import IPersonSet
325+ >>> from lp.registry.interfaces.teammembership import (
326+ ... TeamMembershipStatus)
327 >>> restricted_methods = ('new',)
328-
329-If, for some reason, the techboard team is missing, the security adapter
330-will not allow access and generates an OOPS.
331-
332- >>> from canonical.launchpad.interfaces import (
333- ... IPersonSet, TeamSubscriptionPolicy)
334- >>> personset = getUtility(IPersonSet)
335- >>> login('js@example.com')
336- >>> from zope.app.error.interfaces import IErrorReportingUtility
337- >>> report = getUtility(IErrorReportingUtility).getLastOopsReport()
338- >>> canAccess(ps_factory, 'new')
339- False
340- >>> report2 = getUtility(IErrorReportingUtility).getLastOopsReport()
341- >>> print report.id == report2.id
342- False
343- >>> print report2.value
344- 'techboard' team is missing, has it been renamed?
345-
346-Set up the techboard team:
347-
348- >>> login("foo.bar@canonical.com")
349- >>> owner = personset.getByName("name16")
350- >>> techboard = personset.newTeam(
351- ... owner, "techboard", "techboard",
352- ... subscriptionpolicy=TeamSubscriptionPolicy.OPEN)
353+ >>> techboard = getUtility(ILaunchpadCelebrities).ubuntu_techboard
354+ >>> techboard = removeSecurityProxy(techboard)
355
356 Ordinary users have no access:
357
358@@ -598,7 +581,9 @@
359
360 Now add "test@canonical.com" to the techboard team and log in as him.
361
362- >>> person2.join(techboard)
363+ >>> techboard.addMember(
364+ ... person2, reviewer=person2, status=TeamMembershipStatus.APPROVED,
365+ ... force_team_add=True)
366 >>> login_person(person2)
367
368 Create a new package set.
369@@ -959,8 +944,8 @@
370
371 >>> print_permission(
372 ... ap_set.uploadersForPackageset(ubuntu_archive, kde_ps))
373+ primary techboard: kde -> UPLOAD (implicit)
374 primary juergen: kde -> UPLOAD (implicit)
375- primary techboard: kde -> UPLOAD (implicit)
376
377
378 == Checking package set based upload permissions ==

Subscribers

People subscribed via source and target branches

to status/vote changes: