]> git.llucax.com Git - software/pymin.git/blob - services/proxy/user.py
Add validation to vpn service (refs #20)
[software/pymin.git] / services / proxy / user.py
1 # vim: set encoding=utf-8 et sw=4 sts=4 :
2
3 import crypt
4
5 from pymin.seqtools import Sequence
6 from pymin.service.util import DictSubHandler
7
8 __all__ = ('UserHandler',)
9
10
11 class User(Sequence):
12     def __init__(self, name, password):
13         self.name = name
14         self.password = crypt.crypt(password,'BA')
15     def as_tuple(self):
16         return (self.name, self.password)
17     def update(self, password=None):
18         if password is not None:
19             self.password = crypt.crypt(password,'BA')
20
21 class UserHandler(DictSubHandler):
22
23     handler_help = u"Manage proxy users"
24
25     _cont_subhandler_attr = 'users'
26     _cont_subhandler_class = User
27