summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYingtong Li <runassudo@yingtongli.me>2020-06-07 21:36:10 +1000
committerYingtong Li <runassudo@yingtongli.me>2020-06-07 21:36:10 +1000
commita1aa2423adfc39e738063d9151ced02ca92492ab (patch)
treef5cf05a870ef1a90fbdecde68c72a6a907f36fe3
parent74d4c7b333edf8dc40e9af97ab71523ca8e169f2 (diff)
Fix withdraw permission logic
-rw-r--r--sstreasury/models.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/sstreasury/models.py b/sstreasury/models.py
index 0424706..b6b5dbe 100644
--- a/sstreasury/models.py
+++ b/sstreasury/models.py
@@ -160,8 +160,11 @@ class BudgetRevision(models.Model):
return False
def can_withdraw(self, user):
- if not self.can_edit(user):
+ if not self.can_view(user):
return False
+ if user != self.author and user not in self.contributors.all() and not user.groups.filter(name='Treasury').exists():
+ return False
+
if self.state == BudgetState.AWAIT_REVIEW.value or self.state == BudgetState.ENDORSED.value:
return True
return False
Contact (issues, pull requests, etc.) at git@yingtongli.me. Generated by cgit.