summaryrefslogtreecommitdiffstats
path: root/authentic/admin/settings.ptl
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2010-03-25 21:37:58 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2010-03-25 21:37:58 (GMT)
commit292c14a73c90febf6444090f46dec3d3e264085c (patch)
treef89a33dc12def3c41c52ef25895aa90d3b1bb535 /authentic/admin/settings.ptl
parentc0e722eb347b91a32b5e095b7b35f80a25f1b113 (diff)
downloadauthentic-old-292c14a73c90febf6444090f46dec3d3e264085c.zip
authentic-old-292c14a73c90febf6444090f46dec3d3e264085c.tar.gz
authentic-old-292c14a73c90febf6444090f46dec3d3e264085c.tar.bz2
Move schema to their own directory, start idp branch of the configuration schema
Diffstat (limited to 'authentic/admin/settings.ptl')
-rw-r--r--authentic/admin/settings.ptl248
1 files changed, 16 insertions, 232 deletions
diff --git a/authentic/admin/settings.ptl b/authentic/admin/settings.ptl
index cceb5d7..6ebe8c3 100644
--- a/authentic/admin/settings.ptl
+++ b/authentic/admin/settings.ptl
@@ -35,7 +35,8 @@ import authentic
from authentic import identities
from authentic import misc
from authentic.form import *
-from configuration import configuration
+import configuration
+import authentic.schemas.schemagui as schemagui
template_error_page = error_page
@@ -694,22 +695,22 @@ class LibertyProviderUI(Directory):
-class SettingsDirectory(authentic.schemagui.SettingDirectory):
- _schema = configuration
+class SettingsDirectory(schemagui.SettingDirectory):
_q_exports = ['', 'idp', 'liberty_providers',
'identity_storage', 'identity_options', 'themes', 'passwords',
- 'debug_options', 'emails', 'language', 'login', 'template', 'texts',
- 'sitename', 'ssl', 'upload_theme', 'debug', 'identities']
+ 'debug', 'debug_options', 'emails', 'language', 'login', 'template', 'branding', 'texts',
+ 'misc', 'sitename', 'ssl', 'upload_theme', 'debug', 'identities']
emails = EmailsDirectory()
texts = TextsDirectory()
liberty_providers = LibertyProvidersDir()
- def _q_traverse(self, path):
- get_response().breadcrumb.append(('settings/', _('Settings')))
- return Directory._q_traverse(self, path)
+ def get_configuration(self, path):
+ return configuration.get_configuration(path)
+ def get_schema(self):
+ return configuration.configuration
def _q_index [html] (self):
get_publisher().reload_cfg()
@@ -782,83 +783,6 @@ class SettingsDirectory(authentic.schemagui.SettingDirectory):
def identity_options(self):
return self.identities()
- def identity_options [html] (self):
- form = Form(enctype='multipart/form-data')
- identities_cfg = get_cfg('identities', {})
- form.add(SingleSelectWidget, 'creation', title = _('Identity Creation'),
- value = identities_cfg.get('creation', 'admin'),
- options = [(str('admin'), _('Site Administrator')),
- (str('self'), _('Self-registration')),
- (str('moderated'), _('Moderated user registration'))])
- form.add(CheckboxWidget, 'notify-on-register',
- title = _('Notify Administrators on Registration'),
- value = identities_cfg.get('notify-on-register', False))
- form.add(CheckboxWidget, 'email-as-username', title = _('Use email as username'),
- value = identities_cfg.get('email-as-username', False))
- form.add(TextWidget, 'welcome-email', title = _('Welcome email'),
- cols = 80, rows = 20,
- value = identities_cfg.get('welcome-email', ''),
- hint = _('Available variables: username, password, hostname'))
-
- if identities_cfg.get('locked') is None:
- form.add_submit('submit', _('Submit'))
- form.add_submit('cancel', _('Cancel'))
-
- if form.get_submit() == 'cancel':
- return redirect('.')
-
- if form.is_submitted() and not form.has_errors():
- cfg_submit(form, 'identities',
- ['creation', 'email-as-username', 'welcome-email', 'notify-on-register'])
- return redirect('.')
-
- get_response().breadcrumb.append(('identity_options', _('Identities Interface')))
- html_top('settings', title = _('Identities Interface'))
- '<h2>%s</h2>' % _('Identities Interface')
- if identities_cfg.get('locked') is not None:
- '<div class="infonotice">'
- identities_cfg.get('locked')
- '</div>'
- form.render()
-
- def passwords [html] (self):
- form = Form(enctype='multipart/form-data')
- passwords_cfg = get_cfg('passwords', {})
- form.add(CheckboxWidget, 'can_change', title = _('User can change their password'),
- value = passwords_cfg.get('can_change', False))
- form.add(CheckboxWidget, 'generate', title = _('Generate initial password'),
- value = passwords_cfg.get('generate', True))
- form.add(SingleSelectWidget, 'lost_password_behaviour',
- title = _('Lost Password Behaviour'),
- value = passwords_cfg.get('lost_password_behaviour', 'nothing'),
- options = [ (str('nothing'), _('Nothing (contact admin)')),
- (str('email_reminder'), _('Email reminder')),
- (str('dumb_question'), _('Question selected by user'))] )
- form.add(IntWidget, 'min_length', title = _('Minimum password length'),
- value = int(passwords_cfg.get('min_length', 0)))
- form.add(IntWidget, 'max_length', title = _('Maximum password length'),
- value = int(passwords_cfg.get('max_length', 0)),
- hint = _('0 for unlimited length'))
- form.add(CheckboxWidget, 'log_wrong_passwords',
- title = _('Log wrong passwords'),
- value = passwords_cfg.get('log_wrong_passwords', False))
-
- form.add_submit('submit', _('Submit'))
- form.add_submit('cancel', _('Cancel'))
- if form.get_submit() == 'cancel':
- return redirect('.')
-
- if form.is_submitted() and not form.has_errors():
- cfg_submit(form, 'passwords', ['can_change', 'generate',
- 'lost_password_behaviour', 'min_length', 'max_length',
- 'log_wrong_passwords'])
- return redirect('.')
-
- get_response().breadcrumb.append(('passwords', _('Passwords')))
- html_top('settings', title = _('Passwords'))
- '<h2>%s</h2>' % _('Passwords')
- form.render()
-
def login [html] (self):
form = Form(enctype='multipart/form-data')
login_cfg = get_cfg('login', {})
@@ -880,35 +804,6 @@ class SettingsDirectory(authentic.schemagui.SettingDirectory):
'<h2>%s</h2>' % _('Login Screen')
form.render()
- def ssl [html] (self):
- form = Form(enctype='multipart/form-data')
- ssl_cfg = get_cfg('ssl', {})
- form.add(CheckboxWidget, 'allow_ssl_login', title = _('Permit login using SSL'),
- value = ssl_cfg.get('allow_ssl_login', False),
- hint = _('Activate the URL /login_ssl that permit to use SSL client certificates for authentification'))
- form.add(CheckboxWidget, 'require_ssl', title = _('Accept login only using SSL'),
- value = ssl_cfg.get('require_ssl', False),
- hint = _('It blocks any access using simple HTTP protocol, you still need to configure your webserver in order to use SSL'))
- form.add(CheckboxWidget, 'allow_certificate_federation', title = _('Allows user to federate their account to any certificate'),
- value = ssl_cfg.get('allow_certificate_federation', False),
- hint = _('Setting this option an user can choose to associate any certificate to their account. You must configure your webserver to allow connection with any client certificate.'))
- form.add(StringWidget, 'dn_to_id_regexp', title = _('Regular expression to map DN to user IDs'),
- value = ssl_cfg.get('dn_to_id_regexp', ''),
- hint = _('It gives a rule to map subject DN of certificates to user IDs in the identity storage'))
- form.add_submit('submit', _('Submit'))
- form.add_submit('cancel', _('Cancel'))
- if form.get_submit() == 'cancel':
- return redirect('.')
-
- if form.is_submitted() and not form.has_errors():
- cfg_submit(form, 'ssl', ['allow_ssl_login','require_ssl','allow_certificate_federation', 'dn_to_id_regexp'])
- return redirect('.')
-
- get_response().breadcrumb.append(('ssl', _('SSL')))
- html_top('settings', title = _('SSL'))
- '<h2>%s</h2>' % _('SSL')
- form.render()
-
def themes [html] (self):
request = get_request()
@@ -995,77 +890,6 @@ class SettingsDirectory(authentic.schemagui.SettingDirectory):
z.close()
return redirect('themes')
- def template [html] (self):
- from qommon.template import get_default_ezt_template
- branding_cfg = get_cfg('branding', {})
- default_template_ezt = get_default_ezt_template()
- template = branding_cfg.get('template', default_template_ezt)
- form = Form(enctype='multipart/form-data')
- form.add(TextWidget, 'template', title = _('Site Template'), value = template,
- cols = 80, rows = 25)
- form.add_submit('submit', _('Submit'))
- form.add_submit('restore-default', _('Restore default template'))
- form.add_submit('cancel', _('Cancel'))
-
- if form.get_submit() == 'cancel':
- return redirect('.')
-
- if form.get_submit() == 'restore-default':
- self.template_submit()
- return redirect('.')
-
- if form.is_submitted() and not form.has_errors():
- self.template_submit(form)
- return redirect('.')
-
- get_response().breadcrumb.append(('template', _('Template')))
- html_top('settings', title = _('Template'))
- '<h2>%s</h2>' % _('Template')
- form.render()
-
- def template_submit(self, form = None):
- from qommon.template import DEFAULT_TEMPLATE_EZT, get_default_ezt_template
- theme_default_template_ezt = get_default_ezt_template()
-
- get_publisher().reload_cfg()
- branding_cfg = get_cfg('branding', {})
-
- if not form:
- template = None
- else:
- template = form.get_widget('template').parse()
- if not template or template in (DEFAULT_TEMPLATE_EZT, theme_default_template_ezt):
- if branding_cfg.has_key('template'):
- del branding_cfg['template']
- else:
- branding_cfg['template'] = template
- get_publisher().cfg['branding'] = branding_cfg
- get_publisher().write_cfg()
-
- def language [html] (self):
- form = Form(enctype='multipart/form-data')
- language_cfg = get_cfg('language', {})
- form.add(SingleSelectWidget, 'language', title = _('Language'),
- value = language_cfg.get('language'),
- options = [ (None, _('System Default')),
- (str('en'), _('English')),
- (str('fr'), _('French')) ] )
-
- form.add_submit('submit', _('Submit'))
- form.add_submit('cancel', _('Cancel'))
- if form.get_submit() == 'cancel':
- return redirect('.')
-
- if form.is_submitted() and not form.has_errors():
- cfg_submit(form, 'language', ['language'])
- return redirect('.')
-
- get_response().breadcrumb.append(('language', _('Language')))
- html_top('settings', title = _('Language'))
- '<h2>%s</h2>' % _('Language')
- form.render()
-
-
def identity_storage [html] (self):
form = Form(enctype='multipart/form-data')
data_source = get_cfg('identity_storage', {})
@@ -1450,53 +1274,13 @@ class SettingsDirectory(authentic.schemagui.SettingDirectory):
get_publisher().write_cfg()
- def debug_options [html] (self):
- form = Form(enctype='multipart/form-data')
- debug_cfg = get_cfg('debug', {})
- form.add(CheckboxWidget, 'debug_panel', title = _('Enable debug panel'),
- value = debug_cfg.get('debug_panel', False))
- form.add(StringWidget, 'error_email', title = _('Email for Tracebacks'),
- value = debug_cfg.get('error_email', ''))
- form.add(SingleSelectWidget, 'display_exceptions', title = _('Display Exceptions'),
- value = debug_cfg.get('display_exceptions', ''),
- options = [ (str(''), _('No display')),
- (str('text'), _('Display as Text')),
- (str('text-in-html'), _('Display as Text in HTML an error page')),
- (str('html'), _('Display as HTML')) ])
- form.add(CheckboxWidget, 'logger', title = _('Logger'),
- value = debug_cfg.get('logger', True))
- form.add_submit('submit', _('Submit'))
- form.add_submit('cancel', _('Cancel'))
-
- if form.get_submit() == 'cancel':
- return redirect('.')
-
- if form.is_submitted() and not form.has_errors():
- cfg_submit(form, 'debug', ('error_email', 'display_exceptions', 'logger', 'debug_panel'))
- return redirect('.')
+ # keep support for old panel url point
+ def debug_options(self):
+ return self.debug()
- get_response().breadcrumb.append(('debug', _('Debug Options')))
- html_top('settings', title = _('Debug Options'))
- '<h2>%s</h2>' % _('Debug Options')
- form.render()
+ def sitename(self):
+ return self.misc()
- def sitename [html] (self):
- form = Form(enctype='multipart/form-data')
- misc_cfg = get_cfg('misc', {})
- form.add(StringWidget, 'sitename', title = _('Site Name'),
- value = misc_cfg.get('sitename', ''))
-
- form.add_submit('submit', _('Submit'))
- form.add_submit('cancel', _('Cancel'))
- if form.get_widget('cancel').parse():
- return redirect('.')
-
- if not form.is_submitted() or form.has_errors():
- get_response().breadcrumb.append(('sitename', _('Site Name')))
- html_top('settings', title = _('Site Name'))
- '<h2>%s</h2>' % _('Site Name')
- form.render()
- else:
- cfg_submit(form, 'misc', ['sitename'])
- redirect('.')
+ def template (self):
+ return self.branding()