Skip to content

Commit

Permalink
Always pass user_id as int to authnz/managers so to avoid check & cast.
Browse files Browse the repository at this point in the history
  • Loading branch information
VJalili committed Oct 11, 2018
1 parent d316b9d commit 6504fe6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
5 changes: 0 additions & 5 deletions lib/galaxy/authnz/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

from galaxy import exceptions
from galaxy import model
from galaxy.util.object_wrapper import SafeStringWrapper
from .psa_authnz import (
BACKENDS_NAME,
on_the_fly_config,
Expand Down Expand Up @@ -181,8 +180,6 @@ def try_get_authz_config(sa_session, user_id, authz_id):
:rtype : model.CloudAuthz
:return: a cloudauthz configuration.
"""
if isinstance(user_id, SafeStringWrapper):
user_id = int(user_id)
qres = sa_session.query(model.CloudAuthz).get(authz_id)
if qres is None:
raise exceptions.ObjectNotFound("An authorization configuration with given ID not found.")
Expand Down Expand Up @@ -267,8 +264,6 @@ def get_cloud_access_credentials(self, cloudauthz, sa_session, user_id, request=
resource provider. See CloudAuthz (https://github.com/galaxyproject/cloudauthz)
for details on the content of this dictionary.
"""
if isinstance(user_id, SafeStringWrapper):
user_id = int(user_id)
config = self._extend_cloudauthz_config(cloudauthz, request, sa_session, user_id)
try:
ca = CloudAuthz()
Expand Down
4 changes: 2 additions & 2 deletions tools/cloud/download.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<requirement type="package" version="0.3.3">cloudbridge</requirement>
</requirements>
<command><![CDATA[
#set $authz_record=$__app__.authnz_manager.try_get_authz_config($__app__.obj.model.context.current, $__user_id__, $__app__.security.decode_id($authz_id.__str__()))
#set $credentials_file = $__app__.authnz_manager.get_cloud_access_credentials_in_file($__app__.config.new_file_path, $authz_record, $__app__.obj.model.context.current, $__user_id__)
#set $authz_record=$__app__.authnz_manager.try_get_authz_config($__app__.obj.model.context.current, int($__user_id__), $__app__.security.decode_id($authz_id.__str__()))
#set $credentials_file = $__app__.authnz_manager.get_cloud_access_credentials_in_file($__app__.config.new_file_path, $authz_record, $__app__.obj.model.context.current, int($__user_id__))
python $__tool_directory__/download.py
--provider=$authz_record.provider
--filename=$filename
Expand Down

0 comments on commit 6504fe6

Please sign in to comment.