1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
Review person
=============
Launchpad admins such as Foo Bar can review users and update some of
their information.
>>> admin_browser.open('http://launchpad.dev/~salgado')
>>> admin_browser.getLink('Administer').click()
>>> print admin_browser.url
http://launchpad.dev/~salgado/+review
>>> print admin_browser.title
Review person...
>>> admin_browser.getControl(
... 'Display Name', index=0).value = 'The one and only Salgado'
>>> admin_browser.getControl('Change').click()
>>> print admin_browser.title
The one and only Salgado in Launchpad
Review account
--------------
The review page has a link to the review account page.
>>> admin_browser.getLink('Administer').click()
>>> link = admin_browser.getLink(url='+reviewaccount')
>>> print link.text
edit[IMG] Review the user's account information
>>> link.click()
>>> print admin_browser.title
Review person's account...
The +reviewaccount page displays account information that is normally
hidden from the UI.
>>> content = find_main_content(admin_browser.contents)
>>> for tr in content.find(id='summary').findAll('tr'):
... print extract_text(tr)
Created: 2005-06-06
Creation reason: Created by the owner himself, coming from Launchpad.
OpenID Identifiers: salgado_oid
Email Addresses: guilherme.salgado@canonical.com
The page also contains a link back to the +review page.
>>> link = admin_browser.getLink(url='+review')
>>> print link.text
edit[IMG] Review the user's Launchpad information
The admin can update the user's account. Suspending an account will give a
feedback message.
>>> admin_browser.getControl(
... 'The status of this account').value = ['SUSPENDED']
>>> admin_browser.getControl(
... name='field.status_comment').value = 'Bad boy.'
>>> admin_browser.getControl('Change').click()
>>> print admin_browser.title
The one and only Salgado does not use Launchpad
>>> print get_feedback_messages(admin_browser.contents)[0]
The account "Guilherme Salgado" has been suspended.
The admin can see the account information of a user that does not use
Launchpad, and can change the account too. Note that all pages that belong
to a suspended user have a 410 status code to ensure search engines remove
them from their index.
>>> admin_browser.getLink('Administer').click()
>>> admin_browser.getLink(url='+reviewaccount').click()
>>> print admin_browser.title
Review person's account...
>>> control = admin_browser.getControl(name='field.status_comment')
>>> print control.value
Bad boy.
>>> control.value = 'Reinstated after he apologised'
>>> admin_browser.getControl(
... 'The status of this account').value = ['ACTIVE']
>>> admin_browser.getControl('Change').click()
>>> print admin_browser.title
The one and only Salgado does not use Launchpad
>>> for message in get_feedback_messages(admin_browser.contents):
... print message
The user is reactivated. He must use the "forgot password" to log in.
Registry experts
----------------
Registry experts can see the +review page, minus the displayname.
>>> email = "expert@example.com"
>>> password = "test"
>>> expert= factory.makeRegistryExpert(email=email, password=password)
>>> expert_browser = setupBrowser(auth='Basic %s:%s' % (email, password))
>>> logout()
>>> expert_browser.open('http://launchpad.dev/~no-priv/+review')
>>> print expert_browser.title
Review person...
>>> expert_browser.getControl('Name', index=0).value = "no-way"
>>> expert_browser.getControl(
... 'Display Name', index=0)
Traceback (most recent call last):
...
LookupError: label 'Display Name'
>>> expert_browser.getControl('Personal standing').value = ['GOOD']
>>> expert_browser.getControl(
... name='field.personal_standing_reason').value = 'good guy'
>>> expert_browser.getControl('Change').click()
>>> print expert_browser.url
http://launchpad.dev/~no-way
However, members of the registry team only get partial access to the
review account page to be able to suspend spam accounts.
>>> expert_browser.open('http://launchpad.dev/~no-way/+reviewaccount')
>>> print expert_browser.title
Review person's account...
The +reviewaccount page does not display account information for registry
experts. It also has no form elements to change the display name or the
password.
>>> content = find_main_content(expert_browser.contents)
>>> print content.find(id='summary')
None
>>> print content.find(name='field.displayname')
None
>>> print content.find(name='field.password')
None
The only option for registry experts is to change an account's status and to
provide a reason why they did it. After suspending the account the
page will only be visible to admins, so the registry expert will be
redirected to the "people" main page. A feedback message informs the expert
about the suspension.
>>> control = expert_browser.getControl(name='field.status_comment')
>>> control.value = 'This is SPAM!'
>>> expert_browser.getControl(
... 'The status of this account').value = ['SUSPENDED']
>>> expert_browser.getControl('Change').click()
>>> print expert_browser.url
http://launchpad.dev/people
>>> print get_feedback_messages(expert_browser.contents)[0]
The account "No Privileges Person" has been suspended.
Restricted to admins
--------------------
Non admins cannot access the +review and +reviewaccount pages.
>>> user_browser.open('http://launchpad.dev/~salgado')
>>> user_browser.getLink('Administer')
Traceback (most recent call last):
...
LinkNotFoundError
>>> user_browser.open('http://launchpad.dev/~salgado/+review')
Traceback (most recent call last):
...
Unauthorized: ...
>>> user_browser.open('http://launchpad.dev/~salgado/+reviewaccount')
Traceback (most recent call last):
...
Unauthorized: ...
|