diff --git a/development.ini b/development.ini --- a/development.ini +++ b/development.ini @@ -171,7 +171,7 @@ default_encoding = utf8 #clone_uri = {scheme}://{user}{pass}{netloc}{path} -## issue tracker RhodeCode (leave blank to disable, absent for default) +## issue tracker for RhodeCode (leave blank to disable, absent for default) #bugtracker = http://bitbucket.org/marcinkuzminski/rhodecode/issues ## issue tracking mapping for commits messages @@ -219,8 +219,13 @@ auth_ret_code = ## codes don't break the transactions while 4XX codes do lock_ret_code = 423 +## allows to change the repository location in settings page allow_repo_location_change = True +## allows to setup custom hooks in settings page +allow_custom_hooks_settings = True + + #################################### ### CELERY CONFIG #### #################################### diff --git a/production.ini b/production.ini --- a/production.ini +++ b/production.ini @@ -219,8 +219,13 @@ auth_ret_code = ## codes don't break the transactions while 4XX codes do lock_ret_code = 423 +## allows to change the repository location in settings page allow_repo_location_change = True +## allows to setup custom hooks in settings page +allow_custom_hooks_settings = True + + #################################### ### CELERY CONFIG #### #################################### diff --git a/rhodecode/bin/template.ini.mako b/rhodecode/bin/template.ini.mako --- a/rhodecode/bin/template.ini.mako +++ b/rhodecode/bin/template.ini.mako @@ -227,9 +227,12 @@ auth_ret_code = <%text>## codes don't break the transactions while 4XX codes do lock_ret_code = 423 -<%text>## allow chaning the repository store location from web interface +<%text>## allows to change the repository location in settings page allow_repo_location_change = True +<%text>## allows to setup custom hooks in settings page +allow_custom_hooks_settings = True + <%text> #################################### ### CELERY CONFIG #### diff --git a/rhodecode/config/deployment.ini_tmpl b/rhodecode/config/deployment.ini_tmpl --- a/rhodecode/config/deployment.ini_tmpl +++ b/rhodecode/config/deployment.ini_tmpl @@ -219,8 +219,13 @@ auth_ret_code = ## codes don't break the transactions while 4XX codes do lock_ret_code = 423 +## allows to change the repository location in settings page allow_repo_location_change = True +## allows to setup custom hooks in settings page +allow_custom_hooks_settings = True + + #################################### ### CELERY CONFIG #### #################################### diff --git a/rhodecode/controllers/admin/settings.py b/rhodecode/controllers/admin/settings.py --- a/rhodecode/controllers/admin/settings.py +++ b/rhodecode/controllers/admin/settings.py @@ -309,30 +309,31 @@ class SettingsController(BaseController) 'application settings'), category='error') if setting_id == 'hooks': - ui_key = request.POST.get('new_hook_ui_key') - ui_value = request.POST.get('new_hook_ui_value') - try: + if c.visual.allow_custom_hooks_settings: + ui_key = request.POST.get('new_hook_ui_key') + ui_value = request.POST.get('new_hook_ui_value') + try: - if ui_value and ui_key: - RhodeCodeUi.create_or_update_hook(ui_key, ui_value) - h.flash(_('Added new hook'), - category='success') + if ui_value and ui_key: + RhodeCodeUi.create_or_update_hook(ui_key, ui_value) + h.flash(_('Added new hook'), + category='success') - # check for edits - update = False - _d = request.POST.dict_of_lists() - for k, v in zip(_d.get('hook_ui_key', []), - _d.get('hook_ui_value_new', [])): - RhodeCodeUi.create_or_update_hook(k, v) - update = True + # check for edits + update = False + _d = request.POST.dict_of_lists() + for k, v in zip(_d.get('hook_ui_key', []), + _d.get('hook_ui_value_new', [])): + RhodeCodeUi.create_or_update_hook(k, v) + update = True - if update: - h.flash(_('Updated hooks'), category='success') - Session().commit() - except Exception: - log.error(traceback.format_exc()) - h.flash(_('Error occurred during hook creation'), - category='error') + if update: + h.flash(_('Updated hooks'), category='success') + Session().commit() + except Exception: + log.error(traceback.format_exc()) + h.flash(_('Error occurred during hook creation'), + category='error') return redirect(url('admin_edit_setting', setting_id='hooks')) diff --git a/rhodecode/lib/base.py b/rhodecode/lib/base.py --- a/rhodecode/lib/base.py +++ b/rhodecode/lib/base.py @@ -279,6 +279,7 @@ class BaseController(WSGIController): ## INI stored self.cut_off_limit = int(config.get('cut_off_limit')) c.visual.allow_repo_location_change = str2bool(config.get('allow_repo_location_change', True)) + c.visual.allow_custom_hooks_settings = str2bool(config.get('allow_custom_hooks_settings', True)) c.repo_name = get_repo_slug(request) # can be empty c.backends = BACKENDS.keys() diff --git a/rhodecode/templates/admin/settings/hooks.html b/rhodecode/templates/admin/settings/hooks.html --- a/rhodecode/templates/admin/settings/hooks.html +++ b/rhodecode/templates/admin/settings/hooks.html @@ -36,7 +36,7 @@ % endfor - + % if c.visual.allow_custom_hooks_settings:

${_('Custom hooks')}

${h.form(url('admin_setting', setting_id='hooks'),method='put')}
@@ -75,6 +75,7 @@
${h.end_form()} + % endif