From 2ecc26d83a517ac7e7452a50d84e9b96e1a9e8af Mon Sep 17 00:00:00 2001 From: Martin Cech Date: Wed, 13 Apr 2016 17:12:53 -0400 Subject: [PATCH 1/2] remove unused config; clarify sample; provide default for inactive message --- config/galaxy.ini.sample | 7 +++---- lib/galaxy/config.py | 6 ++++-- lib/galaxy/webapps/galaxy/controllers/root.py | 3 +-- lib/galaxy/webapps/galaxy/controllers/user.py | 3 --- lib/galaxy/webapps/tool_shed/config.py | 3 --- templates/base/base_panels.mako | 2 +- 6 files changed, 9 insertions(+), 15 deletions(-) diff --git a/config/galaxy.ini.sample b/config/galaxy.ini.sample index dbc13b0ca32..fd6a4beaaa7 100644 --- a/config/galaxy.ini.sample +++ b/config/galaxy.ini.sample @@ -407,12 +407,11 @@ paste.app_factory = galaxy.web.buildapp:app_factory # Activation grace period (in hours). Activation is not forced (login is not # disabled) until grace period has passed. Users under grace period can't run -# jobs (see inactivity_box_content). Default is 3. Enter 0 to disable grace -# period. +# jobs. Enter 0 to disable grace period. # Users with OpenID logins have grace period forever. -#activation_grace_period = 0 +#activation_grace_period = 3 -# Used for warning box for inactive accounts (unable to run jobs). +# Shown in warning box to users that were not activated yet. # In use only if activation_grace_period is set. #inactivity_box_content = Your account has not been activated yet. Feel free to browse around and see what's available, but you won't be able to upload data or run jobs until you have verified your email address. diff --git a/lib/galaxy/config.py b/lib/galaxy/config.py index bfae71b72db..68ed69b2ab4 100644 --- a/lib/galaxy/config.py +++ b/lib/galaxy/config.py @@ -194,8 +194,10 @@ class Configuration( object ): activation_email = kwargs.get( 'activation_email', None ) self.email_from = kwargs.get( 'email_from', activation_email ) self.user_activation_on = string_as_bool( kwargs.get( 'user_activation_on', False ) ) - self.activation_grace_period = kwargs.get( 'activation_grace_period', None ) - self.inactivity_box_content = kwargs.get( 'inactivity_box_content', None ) + self.activation_grace_period = int( kwargs.get( 'activation_grace_period', 3 ) ) + default_inactivity_box_content = ( "Your account has not been activated yet. Feel free to browse around and see what's available, but" + " you won't be able to upload data or run jobs until you have verified your email address." ) + self.inactivity_box_content = kwargs.get( 'inactivity_box_content', default_inactivity_box_content ) self.terms_url = kwargs.get( 'terms_url', None ) self.instance_resource_url = kwargs.get( 'instance_resource_url', None ) self.registration_warning_message = kwargs.get( 'registration_warning_message', None ) diff --git a/lib/galaxy/webapps/galaxy/controllers/root.py b/lib/galaxy/webapps/galaxy/controllers/root.py index 152a44c44f1..83bbaaea303 100644 --- a/lib/galaxy/webapps/galaxy/controllers/root.py +++ b/lib/galaxy/webapps/galaxy/controllers/root.py @@ -48,7 +48,6 @@ class RootController( controller.JSAppLauncher, UsesAnnotations ): def _get_extended_config( self, trans ): app = trans.app - configured_for_inactivity_warning = app.config.user_activation_on and app.config.inactivity_box_content is not None user_requests = bool( trans.user and ( trans.user.requests or app.security_agent.get_accessible_request_types( trans, trans.user ) ) ) config = { 'active_view' : 'analysis', @@ -59,7 +58,7 @@ class RootController( controller.JSAppLauncher, UsesAnnotations ): 'toolbox' : app.toolbox.to_dict( trans, in_panel=False ), 'toolbox_in_panel' : app.toolbox.to_dict( trans ), 'message_box_visible' : app.config.message_box_visible, - 'show_inactivity_warning' : configured_for_inactivity_warning and trans.user and not trans.user.active, + 'show_inactivity_warning' : app.config.user_activation_on and trans.user and not trans.user.active, # TODO: move to user 'user_requests' : user_requests } diff --git a/lib/galaxy/webapps/galaxy/controllers/user.py b/lib/galaxy/webapps/galaxy/controllers/user.py index 5af341c7f3b..677e971f5ec 100644 --- a/lib/galaxy/webapps/galaxy/controllers/user.py +++ b/lib/galaxy/webapps/galaxy/controllers/user.py @@ -617,9 +617,6 @@ class User( BaseUIController, UsesFormDefinitionsMixin, CreatesUsersMixin, Creat """ # Activation is forced and the user is not active yet. Check the grace period. activation_grace_period = trans.app.config.activation_grace_period - # Default value is 3 hours. - if activation_grace_period is None: - activation_grace_period = 3 delta = timedelta( hours=int( activation_grace_period ) ) time_difference = datetime.utcnow() - create_time return ( time_difference > delta or activation_grace_period == 0 ) diff --git a/lib/galaxy/webapps/tool_shed/config.py b/lib/galaxy/webapps/tool_shed/config.py index ad554126864..bd560ba0844 100644 --- a/lib/galaxy/webapps/tool_shed/config.py +++ b/lib/galaxy/webapps/tool_shed/config.py @@ -83,9 +83,6 @@ class Configuration( object ): # Galaxy flavor Docker Image self.enable_galaxy_flavor_docker_image = string_as_bool( kwargs.get( "enable_galaxy_flavor_docker_image", "False" ) ) self.use_remote_user = string_as_bool( kwargs.get( "use_remote_user", "False" ) ) - self.user_activation_on = kwargs.get( 'user_activation_on', None ) - self.activation_grace_period = kwargs.get( 'activation_grace_period', None ) - self.inactivity_box_content = kwargs.get( 'inactivity_box_content', None ) self.registration_warning_message = kwargs.get( 'registration_warning_message', None ) self.terms_url = kwargs.get( 'terms_url', None ) self.blacklist_location = kwargs.get( 'blacklist_file', None ) diff --git a/templates/base/base_panels.mako b/templates/base/base_panels.mako index c4b4d1d2afb..6e8e83838c4 100644 --- a/templates/base/base_panels.mako +++ b/templates/base/base_panels.mako @@ -7,7 +7,7 @@ self.message_box_visible = app.config.message_box_visible self.show_inactivity_warning = False if trans.webapp.name == 'galaxy' and trans.user: - self.show_inactivity_warning = ( ( trans.user.active is False ) and ( app.config.user_activation_on ) and ( app.config.inactivity_box_content is not None ) ) + self.show_inactivity_warning = ( ( trans.user.active is False ) and ( app.config.user_activation_on ) ) self.overlay_visible=False self.active_view=None self.body_class="" From c223ebff6dff348acfe70d329657fc71fef605d1 Mon Sep 17 00:00:00 2001 From: Martin Cech Date: Wed, 27 Jul 2016 13:03:53 -0400 Subject: [PATCH 2/2] explicitly disable activation for TS because inherited user controller wants the property --- lib/galaxy/webapps/tool_shed/config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/galaxy/webapps/tool_shed/config.py b/lib/galaxy/webapps/tool_shed/config.py index bd560ba0844..6ffef60aade 100644 --- a/lib/galaxy/webapps/tool_shed/config.py +++ b/lib/galaxy/webapps/tool_shed/config.py @@ -83,6 +83,7 @@ class Configuration( object ): # Galaxy flavor Docker Image self.enable_galaxy_flavor_docker_image = string_as_bool( kwargs.get( "enable_galaxy_flavor_docker_image", "False" ) ) self.use_remote_user = string_as_bool( kwargs.get( "use_remote_user", "False" ) ) + self.user_activation_on = None self.registration_warning_message = kwargs.get( 'registration_warning_message', None ) self.terms_url = kwargs.get( 'terms_url', None ) self.blacklist_location = kwargs.get( 'blacklist_file', None )