Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix external_link perm #4

Merged
merged 1 commit into from
Nov 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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