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 collection table perm #10

Merged
merged 1 commit into from
Jun 28, 2021
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
6 changes: 6 additions & 0 deletions seatable_thumbnail/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def has_dtable_asset_read_permission(self):
def can_access_image_through_external_link(self):
if not hasattr(self, 'external_link'):
return False
if not self.external_link.get('dtable_uuid'):
return False

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

Expand Down Expand Up @@ -143,6 +145,10 @@ def is_group_member(self, group_id, email, in_structure=None):
def has_collection_table_permission(self):
if not hasattr(self, 'collection_table'):
return False
if not self.collection_table.get('token'):
return False
if not self.collection_table.get('dtable_uuid'):
return False

token = self.collection_table['token']
obj = self.db_session.query(
Expand Down