Add package collections

Fixes #378
This commit is contained in:
rubenwardy
2023-08-14 21:48:50 +01:00
parent bf20177756
commit f7a5a1218f
17 changed files with 702 additions and 10 deletions

View File

@@ -80,14 +80,14 @@ class Thread(db.Model):
return url_for("threads.unsubscribe", id=self.id)
def check_perm(self, user, perm):
if not user.is_authenticated:
return perm == Permission.SEE_THREAD and not self.private
if type(perm) == str:
perm = Permission[perm]
elif type(perm) != Permission:
raise Exception("Unknown permission given to Thread.check_perm()")
if not user.is_authenticated:
return perm == Permission.SEE_THREAD and not self.private
isMaintainer = user == self.author or (self.package is not None and self.package.author == user)
if self.package:
isMaintainer = isMaintainer or user in self.package.maintainers