root/cherokee/trunk/admin/ModuleHtdigest.py

Revision 1982, 1.2 kB (checked in by alo, 3 months ago)

--

Line 
1 import validations
2
3 from Table import *
4 from ModuleAuth import *
5
6 NOTE_PASSWD = "Full path to the Htdigest formated password file."
7
8 DATA_VALIDATION = [
9     ('vserver!.*?!(directory|extensions|request)!.*?!passwdfile',
10      (validations.is_local_file_exists, 'cfg'))
11 ]
12
13 HELPS = [
14     ('modules_validators_htdigest', "Htdigest")
15 ]
16
17 class ModuleHtdigest (ModuleAuthBase):
18     PROPERTIES = ModuleAuthBase.PROPERTIES + [
19         'passwdfile'
20     ]
21
22     METHODS = ['basic', 'digest']
23
24     def __init__ (self, cfg, prefix, submit):
25         ModuleAuthBase.__init__ (self, cfg, prefix, 'htdigest', submit)
26
27     def _op_render (self):
28         txt  = ModuleAuthBase._op_render (self)
29
30         table = TableProps()
31         self.AddPropEntry (table, "Password File", "%s!passwdfile"%(self._prefix), NOTE_PASSWD)
32
33         txt += "<h2>Htpasswd file</h2>"
34         txt += self.Indent(table)
35         return txt
36
37     def _op_apply_changes (self, uri, post):
38         pre = '%s!passwdfile' % (self._prefix)
39         self.Validate_NotEmpty (post, pre, 'Password file can not be empty')
40
41         self.ApplyChanges ([], post, DATA_VALIDATION)
42         ModuleAuthBase._op_apply_changes (self, uri, post)
Note: See TracBrowser for help on using the browser.