Stop protecting certain settings from being edited
we no longer expose settings to 'chuck' user etc.
This commit is contained in:
parent
310baea00f
commit
25a7d46588
|
@ -17,7 +17,7 @@ def includeme(config):
|
||||||
config.include('tailbone_corepos.views.customers')
|
config.include('tailbone_corepos.views.customers')
|
||||||
config.include('tailbone.views.datasync')
|
config.include('tailbone.views.datasync')
|
||||||
config.include('rattail_demo.web.views.departments')
|
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('rattail_demo.web.views.employees')
|
||||||
config.include('tailbone.views.families')
|
config.include('tailbone.views.families')
|
||||||
config.include('tailbone_corepos.views.members')
|
config.include('tailbone_corepos.views.members')
|
||||||
|
@ -26,7 +26,7 @@ def includeme(config):
|
||||||
config.include('rattail_demo.web.views.products')
|
config.include('rattail_demo.web.views.products')
|
||||||
config.include('tailbone.views.reportcodes')
|
config.include('tailbone.views.reportcodes')
|
||||||
config.include('tailbone.views.roles')
|
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.views.stores')
|
||||||
config.include('tailbone_corepos.views.subdepartments')
|
config.include('tailbone_corepos.views.subdepartments')
|
||||||
config.include('tailbone.views.tempmon')
|
config.include('tailbone.views.tempmon')
|
||||||
|
|
|
@ -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)
|
|
|
@ -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)
|
|
Loading…
Reference in a new issue