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 error when checking is_admin #501

Merged
merged 3 commits into from
Jan 8, 2019
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
5 changes: 4 additions & 1 deletion backend/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ def get(self):

if dataset_version.available_from > datetime.now():
# If it's not available yet, only return if user is admin.
if not (self.current_user and self.current_user.is_admin(version.dataset)):
if not (self.current_user and self.current_user.is_admin(dataset_version.dataset)):
self.send_error(status_code=403)
return

base_url = "%s://%s" % (self.request.protocol, self.request.host)
dataset_schema['url'] = base_url + "/dataset/" + dataset_version.dataset.short_name
Expand Down Expand Up @@ -574,6 +575,7 @@ def get(self):
"""
if db.get_admin_datasets(self.current_user).count() <= 0:
self.finish({'user':None, 'expires':None, 'password':None})
return

password = None
username = None
Expand All @@ -599,6 +601,7 @@ def post(self):
"""
if db.get_admin_datasets(self.current_user).count() <= 0:
self.finish({'user':None, 'expires':None, 'password':None})
return

# Create a new password
username = "_".join(self.current_user.name.split()) + "_sftp"
Expand Down