mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
sas: simplify and optimize permissions for SAS images
This commit is contained in:
parent
1f86827e46
commit
8330e1eaf2
@ -71,16 +71,11 @@ class Picture(SithFile):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def can_be_edited_by(self, user):
|
def can_be_edited_by(self, user):
|
||||||
# file = SithFile.objects.filter(id=self.id).first()
|
return user.is_in_group(settings.SITH_GROUP_SAS_ADMIN_ID)
|
||||||
return user.is_in_group(
|
|
||||||
settings.SITH_GROUP_SAS_ADMIN_ID
|
|
||||||
) # or user.can_edit(file)
|
|
||||||
|
|
||||||
def can_be_viewed_by(self, user):
|
def can_be_viewed_by(self, user):
|
||||||
# file = SithFile.objects.filter(id=self.id).first()
|
# SAS pictures are visible to old subscribers
|
||||||
return self.can_be_edited_by(user) or (
|
return self.is_in_sas and self.is_moderated and user.was_subscribed
|
||||||
self.is_in_sas and self.is_moderated and user.was_subscribed
|
|
||||||
) # or user.can_view(file)
|
|
||||||
|
|
||||||
def get_download_url(self):
|
def get_download_url(self):
|
||||||
return reverse("sas:download", kwargs={"picture_id": self.id})
|
return reverse("sas:download", kwargs={"picture_id": self.id})
|
||||||
|
Loading…
Reference in New Issue
Block a user