Skip to content

Commit c6c8c0e

Browse files
committed
Require "manage:organization" to manage org
1 parent 6bd69e6 commit c6c8c0e

File tree

4 files changed

+14
-20
lines changed

4 files changed

+14
-20
lines changed

tests/unit/accounts/test_views.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,9 +2259,7 @@ def test_verify_organization_role(
22592259
)
22602260
if desired_role == "Owner"
22612261
# TODO: Test redirecting to managing organization projects.
2262-
else pretend.call(
2263-
"manage.organization.roles", organization_name=organization.name
2264-
)
2262+
else pretend.call("manage.organizations")
22652263
]
22662264

22672265
@pytest.mark.parametrize(

warehouse/accounts/views.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -996,11 +996,7 @@ def _error(message):
996996
# "manage.organization.projects", name=organization.name
997997
# )
998998
# )
999-
return HTTPSeeOther(
1000-
request.route_path(
1001-
"manage.organization.roles", organization_name=organization.name
1002-
)
1003-
)
999+
return HTTPSeeOther(request.route_path("manage.organizations"))
10041000

10051001

10061002
@view_config(

warehouse/locale/messages.pot

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ msgid "Invalid token: request a new password reset link"
135135
msgstr ""
136136

137137
#: warehouse/accounts/views.py:655 warehouse/accounts/views.py:753
138-
#: warehouse/accounts/views.py:850 warehouse/accounts/views.py:1030
138+
#: warehouse/accounts/views.py:850 warehouse/accounts/views.py:1026
139139
msgid "Invalid token: no token supplied"
140140
msgstr ""
141141

@@ -201,7 +201,7 @@ msgstr ""
201201
msgid "Invalid token: request a new organization invite"
202202
msgstr ""
203203

204-
#: warehouse/accounts/views.py:854 warehouse/accounts/views.py:1034
204+
#: warehouse/accounts/views.py:854 warehouse/accounts/views.py:1030
205205
msgid "Invalid token: not a collaboration invitation token"
206206
msgstr ""
207207

@@ -221,27 +221,27 @@ msgstr ""
221221
msgid "You are now ${role} of the '${organization_name}' organization."
222222
msgstr ""
223223

224-
#: warehouse/accounts/views.py:1026
224+
#: warehouse/accounts/views.py:1022
225225
msgid "Expired token: request a new project role invite"
226226
msgstr ""
227227

228-
#: warehouse/accounts/views.py:1028
228+
#: warehouse/accounts/views.py:1024
229229
msgid "Invalid token: request a new project role invite"
230230
msgstr ""
231231

232-
#: warehouse/accounts/views.py:1038
232+
#: warehouse/accounts/views.py:1034
233233
msgid "Role invitation is not valid."
234234
msgstr ""
235235

236-
#: warehouse/accounts/views.py:1053
236+
#: warehouse/accounts/views.py:1049
237237
msgid "Role invitation no longer exists."
238238
msgstr ""
239239

240-
#: warehouse/accounts/views.py:1065
240+
#: warehouse/accounts/views.py:1061
241241
msgid "Invitation for '${project_name}' is declined."
242242
msgstr ""
243243

244-
#: warehouse/accounts/views.py:1132
244+
#: warehouse/accounts/views.py:1128
245245
msgid "You are now ${role} of the '${project_name}' project."
246246
msgstr ""
247247

warehouse/manage/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ def create_organization(self):
11941194
renderer="manage/organization/roles.html",
11951195
uses_session=True,
11961196
require_methods=False,
1197-
# permission="manage:organization",
1197+
permission="manage:organization",
11981198
has_translations=True,
11991199
require_reauth=True,
12001200
)
@@ -1346,7 +1346,7 @@ def manage_organization_roles(
13461346
context=Organization,
13471347
uses_session=True,
13481348
require_methods=["POST"],
1349-
# permission="manage:organization",
1349+
permission="manage:organization",
13501350
has_translations=True,
13511351
)
13521352
def revoke_organization_invitation(organization, request):
@@ -1424,7 +1424,7 @@ def revoke_organization_invitation(organization, request):
14241424
context=Organization,
14251425
uses_session=True,
14261426
require_methods=["POST"],
1427-
# permission="manage:organization",
1427+
permission="manage:organization",
14281428
has_translations=True,
14291429
require_reauth=True,
14301430
)
@@ -1499,7 +1499,7 @@ def change_organization_role(
14991499
context=Organization,
15001500
uses_session=True,
15011501
require_methods=["POST"],
1502-
# permission="manage:organization",
1502+
permission="manage:organization",
15031503
has_translations=True,
15041504
require_reauth=True,
15051505
)

0 commit comments

Comments
 (0)