Stop protecting certain settings from being edited

we no longer expose settings to 'chuck' user etc.
This commit is contained in:
Lance Edgar 2020-08-06 01:35:29 -05:00
parent 310baea00f
commit 25a7d46588
3 changed files with 2 additions and 72 deletions

View file

@ -17,7 +17,7 @@ def includeme(config):
config.include('tailbone_corepos.views.customers')
config.include('tailbone.views.datasync')
config.include('rattail_demo.web.views.departments')
config.include('rattail_demo.web.views.email')
config.include('tailbone.views.email')
config.include('rattail_demo.web.views.employees')
config.include('tailbone.views.families')
config.include('tailbone_corepos.views.members')
@ -26,7 +26,7 @@ def includeme(config):
config.include('rattail_demo.web.views.products')
config.include('tailbone.views.reportcodes')
config.include('tailbone.views.roles')
config.include('rattail_demo.web.views.settings')
config.include('tailbone.views.settings')
config.include('tailbone.views.stores')
config.include('tailbone_corepos.views.subdepartments')
config.include('tailbone.views.tempmon')

View file

@ -1,32 +0,0 @@
# -*- coding: utf-8; -*-
"""
Email views
"""
from __future__ import unicode_literals, absolute_import
from tailbone.views import email as base
class ProfilesView(base.ProfilesView):
"""
Prevent edit/delete for 'feedback' email config
"""
protected = [
'user_feedback',
'upgrade_success',
'upgrade_failure',
]
def editable_instance(self, profile):
return profile['key'] not in self.protected
def deletable_instance(self, profile):
return profile['key'] not in self.protected
def includeme(config):
ProfilesView.defaults(config)
base.EmailPreview.defaults(config)
base.EmailAttemptView.defaults(config)

View file

@ -1,38 +0,0 @@
# -*- coding: utf-8; -*-
"""
Settings views
"""
from __future__ import unicode_literals, absolute_import
import re
from tailbone.views import settings as base
class SettingsView(base.SettingsView):
"""
Prevent edit/delete for 'feedback' email settings
"""
protected = [
re.compile(r'^rattail\.mail\.user_feedback\..*'),
re.compile(r'^rattail\.mail\.upgrade_success\..*'),
re.compile(r'^rattail\.mail\.upgrade_failure\..*'),
]
def editable_instance(self, setting):
for pattern in self.protected:
if pattern.match(setting.name):
return False
return True
def deletable_instance(self, setting):
for pattern in self.protected:
if pattern.match(setting.name):
return False
return True
def includeme(config):
base.AppSettingsView.defaults(config)
SettingsView.defaults(config)