From 9d362a2400bb1d36b1dec8df5316fca75ea05c08 Mon Sep 17 00:00:00 2001 From: Marius van den Beek Date: Sat, 19 Mar 2016 15:30:48 +0100 Subject: [PATCH 1/3] log warning if user account is not active --- lib/galaxy/webapps/galaxy/api/tools.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/galaxy/webapps/galaxy/api/tools.py b/lib/galaxy/webapps/galaxy/api/tools.py index dfa2febb1e8..5c0cc13fdf1 100644 --- a/lib/galaxy/webapps/galaxy/api/tools.py +++ b/lib/galaxy/webapps/galaxy/api/tools.py @@ -222,6 +222,8 @@ class ToolsController( BaseAPIController, UsesVisualizationMixin ): tool = trans.app.toolbox.get_tool( payload[ 'tool_id' ] , tool_version ) if 'tool_id' in payload else None if not tool or not tool.allow_user_access( trans.user ): raise exceptions.MessageException( 'Tool not found or not accessible.' ) + if trans.app.config.user_activation_on and not trans.user.active: + log.warning("User \"%s\" attempts to execute job, but account is not active" % trans.user.email ) # Set running history from payload parameters. # History not set correctly as part of this API call for From 3b71020dfc1ef6ad4b4ccb09de6317dd059cdb1a Mon Sep 17 00:00:00 2001 From: Marius van den Beek Date: Sun, 20 Mar 2016 11:49:21 +0100 Subject: [PATCH 2/3] Account for anonymous user. --- lib/galaxy/jobs/handler.py | 2 +- lib/galaxy/webapps/galaxy/api/tools.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/jobs/handler.py b/lib/galaxy/jobs/handler.py index e100a55d2cf..5cf7359df2c 100644 --- a/lib/galaxy/jobs/handler.py +++ b/lib/galaxy/jobs/handler.py @@ -186,7 +186,7 @@ class JobHandlerQueue( object ): jobs (either from the database or from its own queue), then iterates over all new and waiting jobs to check the state of the jobs each depends on. If the job has dependencies that have not finished, it - it goes to the waiting queue. If the job has dependencies with errors, + goes to the waiting queue. If the job has dependencies with errors, it is marked as having errors and removed from the queue. If the job belongs to an inactive user it is ignored. Otherwise, the job is dispatched. diff --git a/lib/galaxy/webapps/galaxy/api/tools.py b/lib/galaxy/webapps/galaxy/api/tools.py index 5c0cc13fdf1..80828cb78be 100644 --- a/lib/galaxy/webapps/galaxy/api/tools.py +++ b/lib/galaxy/webapps/galaxy/api/tools.py @@ -222,8 +222,12 @@ class ToolsController( BaseAPIController, UsesVisualizationMixin ): tool = trans.app.toolbox.get_tool( payload[ 'tool_id' ] , tool_version ) if 'tool_id' in payload else None if not tool or not tool.allow_user_access( trans.user ): raise exceptions.MessageException( 'Tool not found or not accessible.' ) - if trans.app.config.user_activation_on and not trans.user.active: - log.warning("User \"%s\" attempts to execute job, but account is not active" % trans.user.email ) + if trans.app.config.user_activation_on: + if not trans.user: + log.warning("Anonymous user attempts to execute tool, but account activation is turned on") + elif not trans.user.active: + log.warning("User \"%s\" attempts to execute tool, but account activation is turned on and user account is not active" % trans.user.email ) + # Set running history from payload parameters. # History not set correctly as part of this API call for From 34dedb3eb97f914e67563ffe84cb791ca7ceb936 Mon Sep 17 00:00:00 2001 From: Marius van den Beek Date: Sun, 20 Mar 2016 12:04:33 +0100 Subject: [PATCH 3/3] linting fixes --- lib/galaxy/webapps/galaxy/api/tools.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/api/tools.py b/lib/galaxy/webapps/galaxy/api/tools.py index 80828cb78be..3b875150fc6 100644 --- a/lib/galaxy/webapps/galaxy/api/tools.py +++ b/lib/galaxy/webapps/galaxy/api/tools.py @@ -224,10 +224,9 @@ class ToolsController( BaseAPIController, UsesVisualizationMixin ): raise exceptions.MessageException( 'Tool not found or not accessible.' ) if trans.app.config.user_activation_on: if not trans.user: - log.warning("Anonymous user attempts to execute tool, but account activation is turned on") + log.warning( "Anonymous user attempts to execute tool, but account activation is turned on." ) elif not trans.user.active: - log.warning("User \"%s\" attempts to execute tool, but account activation is turned on and user account is not active" % trans.user.email ) - + log.warning( "User \"%s\" attempts to execute tool, but account activation is turned on and user account is not active." % trans.user.email ) # Set running history from payload parameters. # History not set correctly as part of this API call for