Skip to content

Commit

Permalink
add new API endpoint which reads a new config file for new user-prefe…
Browse files Browse the repository at this point in the history
…rences
  • Loading branch information
bgruening committed Aug 5, 2016
1 parent 0558225 commit 24dfbaf
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/galaxy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ def __parse_config_file_options( self, kwargs ):
shed_data_manager_config_file=[ 'shed_data_manager_conf.xml', 'config/shed_data_manager_conf.xml' ],
shed_tool_data_table_config=[ 'shed_tool_data_table_conf.xml', 'config/shed_tool_data_table_conf.xml' ],
tool_sheds_config_file=[ 'config/tool_sheds_conf.xml', 'tool_sheds_conf.xml', 'config/tool_sheds_conf.xml.sample' ],
user_preferences_extra_config_file=[ 'config/user_preferences_extra_conf.xml', 'config/user_preferences_extra_conf.xml.sample' ],
workflow_schedulers_config_file=['config/workflow_schedulers_conf.xml', 'config/workflow_schedulers_conf.xml.sample'],
)

Expand Down
25 changes: 25 additions & 0 deletions lib/galaxy/webapps/galaxy/api/user_preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,3 +548,28 @@ def change_password( self, trans, token=None, **kwd):
message=message,
display_top=kwd.get('redirect_home', False)
)'''


@expose_api
def get_extra_preferences( self, trans, cntrller='user_preferences', **kwd ):
"""
Reads the file user_preferences_extra_conf.xml to display admin defined user informations
"""
from yaml import load

path = trans.app.config.user_preferences_extra_config_file

try:
with open(path, 'r') as stream:
config = load(stream)
except:
log.warn('Config file (%s) could not be found or is malformed.' % path)
return config








6 changes: 6 additions & 0 deletions lib/galaxy/webapps/galaxy/buildapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def paste_app_factory( global_conf, **kwargs ):
webapp.add_client_route( '/user_preferences/undelete_address' )
webapp.add_client_route( '/user_preferences/new_address' )
webapp.add_client_route( '/user_preferences/change_password' )
webapp.add_client_route( '/user_preferences/get_extra_preferences' )

# STANDARD CONTROLLER ROUTES
webapp.add_ui_controllers( 'galaxy.webapps.galaxy.controllers', app )
Expand Down Expand Up @@ -512,6 +513,11 @@ def populate_api_routes( webapp, app ):
action='change_password',
conditions=dict( method=["GET"] ) )

webapp.mapper.connect( 'get_extra_preferences',
'/api/user_preferences/get_extra_preferences',
controller='user_preferences',
action='get_extra_preferences',
conditions=dict( method=["GET"] ) )

# =======================
# ===== LIBRARY API =====
Expand Down

0 comments on commit 24dfbaf

Please sign in to comment.