From 1123cbb728d1cb6d6226310d557ab67e85706262 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 25 Oct 2018 17:52:00 -0500 Subject: [PATCH] Only show Restart Filemon button if so configured otherwise everyone would need to include that view in their config --- tailbone/templates/datasync/changes/index.mako | 2 +- tailbone/views/datasync.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tailbone/templates/datasync/changes/index.mako b/tailbone/templates/datasync/changes/index.mako index 1a746144..442bef22 100644 --- a/tailbone/templates/datasync/changes/index.mako +++ b/tailbone/templates/datasync/changes/index.mako @@ -11,7 +11,7 @@ ${h.end_form()} % endif - % if request.has_perm('filemon.restart'): + % if allow_filemon_restart and request.has_perm('filemon.restart'): ${h.form(url('filemon.restart'), name='restart-filemon', class_='autodisable')} ${h.csrf_token(request)} ${h.submit('submit', "Restart FileMon", data_working_label="Restarting FileMon")} diff --git a/tailbone/views/datasync.py b/tailbone/views/datasync.py index 11a98599..1d47fb20 100644 --- a/tailbone/views/datasync.py +++ b/tailbone/views/datasync.py @@ -63,6 +63,10 @@ class DataSyncChangesView(MasterView): g.set_sort_defaults('obtained') g.set_type('obtained', 'datetime') + def template_kwargs_index(self, **kwargs): + kwargs['allow_filemon_restart'] = bool(self.rattail_config.get('tailbone', 'filemon.restart')) + return kwargs + def restart(self): # TODO: Add better validation (e.g. CSRF) here? if self.request.method == 'POST':