Allow editors to unapprove and delete packages

This commit is contained in:
rubenwardy 2020-07-10 20:13:48 +01:00
parent 1daf59b7db
commit ee6de95a52
2 changed files with 19 additions and 3 deletions

View File

@ -69,6 +69,21 @@ title: Ranks and Permissions
<th></th> <!-- admin -->
<th></th>
</tr>
<tr>
<td>Delete Package</td>
<th></th> <!-- new -->
<th></th>
<th></th> <!-- member -->
<th></th>
<th></th> <!-- trusted member -->
<th></th>
<th></th> <!-- editor -->
<th></th>
<th></th> <!-- moderator -->
<th></th>
<th></th> <!-- admin -->
<th></th>
</tr>
<tr>
<td>Edit Package</td>
<th></th> <!-- new -->

View File

@ -708,9 +708,10 @@ class Package(db.Model):
elif perm == Permission.EDIT_MAINTAINERS:
return isOwner or user.rank.atLeast(UserRank.MODERATOR)
# Moderators can delete packages
elif perm == Permission.DELETE_PACKAGE or perm == Permission.UNAPPROVE_PACKAGE \
or perm == Permission.CHANGE_RELEASE_URL:
elif perm == Permission.UNAPPROVE_PACKAGE or perm == Permission.DELETE_PACKAGE:
return user.rank.atLeast(UserRank.EDITOR)
elif perm == Permission.CHANGE_RELEASE_URL:
return user.rank.atLeast(UserRank.MODERATOR)
else: