Skip to content

Commit

Permalink
Fix for absent user ID in RPC context (unauthenticated calls).
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Sutormin committed Mar 30, 2017
1 parent c50f0fd commit 9e8629d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/biokbase/catalog/Impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ def set_secure_config_params(self, ctx, params):
"""
# ctx is the context object
#BEGIN set_secure_config_params
self.cc.set_secure_config_params(ctx['user_id'], params)
self.cc.set_secure_config_params(ctx.get('user_id'), params)
#END set_secure_config_params
pass

Expand All @@ -1397,7 +1397,7 @@ def remove_secure_config_params(self, ctx, params):
"""
# ctx is the context object
#BEGIN remove_secure_config_params
self.cc.remove_secure_config_params(ctx['user_id'], params)
self.cc.remove_secure_config_params(ctx.get('user_id'), params)
#END remove_secure_config_params
pass

Expand All @@ -1418,7 +1418,7 @@ def get_secure_config_params(self, ctx, params):
# ctx is the context object
# return variables are: returnVal
#BEGIN get_secure_config_params
returnVal = self.cc.get_secure_config_params(ctx['user_id'], params)
returnVal = self.cc.get_secure_config_params(ctx.get('user_id'), params)
#END get_secure_config_params

# At some point might do deeper type checking...
Expand Down
6 changes: 3 additions & 3 deletions lib/biokbase/catalog/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1445,7 +1445,7 @@ def list_volume_mounts(self, username, filter):


def set_secure_config_params(self, username, params):
if not self.is_admin(username):
if username is None or not self.is_admin(username):
raise ValueError('You do not have permission to work with hidden configuration ' +
'parameters.')

Expand All @@ -1458,7 +1458,7 @@ def set_secure_config_params(self, username, params):


def remove_secure_config_params(self, username, params):
if not self.is_admin(username):
if username is None or not self.is_admin(username):
raise ValueError('You do not have permission to work with hidden configuration ' +
'parameters.')

Expand All @@ -1471,7 +1471,7 @@ def remove_secure_config_params(self, username, params):


def get_secure_config_params(self, username, params):
if not self.is_admin(username):
if username is None or not self.is_admin(username):
raise ValueError('You do not have permission to work with hidden configuration ' +
'parameters.')

Expand Down

0 comments on commit 9e8629d

Please sign in to comment.