Add manual plugin selection

* larpe/admin/hosts.ptl: add a field to select a plugin
 * larpe/plugins/site_authentication_plugins.py: add a method
   which returns the plugins name
 * po/fr.po: add french translations

git-svn-id: svn+ssh://labs.libre-entreprise.org/svnroot/larpe@492 3ed937ae-f919-0410-9a43-8e6f19e4ba6e
This commit is contained in:
jschneider 2009-11-17 15:59:05 +00:00
parent 975848b053
commit 051fa1609b
4 changed files with 1483 additions and 1277 deletions

View File

@ -452,7 +452,14 @@ modify the address or the name of this site</a>'''))
write_apache2_vhosts()
def check_auto_detected_configuration [html] (self):
plugins_name = site_authentication_plugins.get_plugins_name()
plugins_name.append(None)
plugins_name.sort()
form = Form(enctype='multipart/form-data')
form.add(SingleSelectWidget, 'plugin', title = _('Plugin'), required = False,
hint = _('You can force a plugin'),
value = self.host.site_authentication_plugin,
options = plugins_name)
form.add_submit('cancel', _('Previous'))
form.add_submit('submit', _('Next'))
form.add_submit('terminate', _('Terminate'))
@ -461,7 +468,10 @@ modify the address or the name of this site</a>'''))
return redirect('authentication_and_logout_adresses')
if form.is_submitted():
self.host.site_authentication_plugin = form.get_widget('plugin').parse()
self.host.store()
if form.get_widget('terminate').parse():
write_apache2_vhosts()
return redirect('..')
return redirect('credentials')
@ -518,7 +528,6 @@ your settings then try again.
get_response().breadcrumb.append(('credentials', _('Credentials')))
self.html_top(_('Step 5 - Fill in a valid username/password for this site'))
form.render()
def form_credentials(self):
@ -1042,7 +1051,8 @@ back and check your settings.''') % { 'finish': _('Finish') }
# Default authentication mode
self.host.auth_mode = 'form'
self.host.site_authentication_plugin = site_authentication_plugins.auto_detect(page)
if not self.host.site_authentication_plugin:
self.host.site_authentication_plugin = site_authentication_plugins.auto_detect(page)
self.parse_frames(page)
self.parse_forms(page)
if self.host.auth_form is not None:

View File

@ -1,3 +1,4 @@
import ipdb
class SiteAuthenticationPlugins:
""" This class manages the plugins for site authentification """
@ -16,6 +17,12 @@ class SiteAuthenticationPlugins:
else:
return None
def get_plugins_name(self):
plugins_name = list()
for plugin_name in self.site_authentication_classes.iterkeys():
plugins_name.append(plugin_name)
return plugins_name
def auto_detect(self, html_doc):
"""
Try to find automatically the right plugin name

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff