Skip to content

Commit ac97462

Browse files
committed
Add 'manage' permission
1 parent 4085c91 commit ac97462

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

tests/unit/packaging/test_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ def test_acl(self, db_session):
9595

9696
assert project.__acl__() == [
9797
(Allow, "group:admins", "admin"),
98-
(Allow, owner1.user.id, ["upload"]),
99-
(Allow, owner2.user.id, ["upload"]),
98+
(Allow, owner1.user.id, ["manage", "upload"]),
99+
(Allow, owner2.user.id, ["manage", "upload"]),
100100
(Allow, maintainer1.user.id, ["upload"]),
101101
(Allow, maintainer2.user.id, ["upload"]),
102102
]

warehouse/packaging/models.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,10 @@ def __acl__(self):
147147
for role in sorted(
148148
query.all(),
149149
key=lambda x: ["Owner", "Maintainer"].index(x.role_name)):
150-
acls.append((Allow, role.user.id, ["upload"]))
151-
150+
if role.role_name == "Owner":
151+
acls.append((Allow, role.user.id, ["manage", "upload"]))
152+
else:
153+
acls.append((Allow, role.user.id, ["upload"]))
152154
return acls
153155

154156
@property

0 commit comments

Comments
 (0)