Skip to content

Commit

Permalink
Merge pull request #501 from NBISweden/bugfix/linus-isadmin
Browse files Browse the repository at this point in the history
Fix error when checking is_admin
  • Loading branch information
kusalananda committed Jan 8, 2019
2 parents 8103c39 + 35d4b5f commit 946d2d0
Showing 1 changed file with 4 additions and 1 deletion.
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

0 comments on commit 946d2d0

Please sign in to comment.