Commit 8330e1ea authored by Sli's avatar Sli

sas: simplify and optimize permissions for SAS images

parent 1f86827e
Pipeline #2019 passed with stage
in 52 minutes and 23 seconds
......@@ -71,16 +71,11 @@ class Picture(SithFile):
return False
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
) # or user.can_edit(file)
return user.is_in_group(settings.SITH_GROUP_SAS_ADMIN_ID)
def can_be_viewed_by(self, user):
# file = SithFile.objects.filter(id=self.id).first()
return self.can_be_edited_by(user) or (
self.is_in_sas and self.is_moderated and user.was_subscribed
) # or user.can_view(file)
# SAS pictures are visible to old subscribers
return self.is_in_sas and self.is_moderated and user.was_subscribed
def get_download_url(self):
return reverse("sas:download", kwargs={"picture_id": self.id})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment