1 # -*- encoding: utf-8 -*-
10 def validate_authentication(self, username, password):
11 """Return True if the supplied username and password match the
12 stored credentials."""
13 self.password = password
16 def impersonate_user(self, username, password):
17 """Impersonate another user (noop).
19 It is always called before accessing the filesystem.
20 By default it does nothing. The subclass overriding this
21 method is expected to provide a mechanism to change the
25 def terminate_impersonation(self):
26 """Terminate impersonation (noop).
28 It is always called after having accessed the filesystem.
29 By default it does nothing. The subclass overriding this
30 method is expected to provide a mechanism to switch back
34 def has_user(self, username):
35 """Whether the username exists in the virtual users table."""
36 if username=='anonymous':
40 def has_perm(self, username, perm, path=None):
41 """Whether the user has permission over path (an absolute
42 pathname of a file or a directory).
44 Expected perm argument is one of the following letters:
47 paths = path.split('/')
51 db,pool = pooler.get_db_and_pool(db_name)
52 res = security.login(db_name, username, self.password)
55 def get_perms(self, username):
56 """Return current user permissions."""
59 def get_home_dir(self, username):
60 """Return the user's home directory."""
63 def get_msg_login(self, username):
64 """Return the user's login message."""
65 return 'Welcome on OpenERP document management system.'
67 def get_msg_quit(self, username):
68 """Return the user's quitting message."""
71 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: