Skip to content

Commit

Permalink
Merge pull request #4 from seatable/fix-external-link
Browse files Browse the repository at this point in the history
fix external_link perm
  • Loading branch information
freeplant authored Nov 11, 2020
2 parents 24b36f1 + 8c306fb commit d145757
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions seatable_thumbnail/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,19 @@ def has_dtable_asset_read_permission(self):
# 2. through dtable perm, including dtable share
# 3. through view share perm

if not hasattr(self, 'username'):
if self.can_access_image_through_external_link():
return True
else:
if 'r' in self.check_dtable_permission():
return True
if 'r' in self.get_view_share_permission():
return True
if self.can_access_image_through_external_link():
return True
if 'r' in self.check_dtable_permission():
return True
if 'r' in self.get_view_share_permission():
return True

return False

def can_access_image_through_external_link(self):
if not hasattr(self, 'external_link'):
return False

return self.external_link['dtable_uuid'] == self.dtable_uuid

def check_dtable_permission(self):
Expand Down

0 comments on commit d145757

Please sign in to comment.