source: main/waeup.sirp/branches/workshop2010-playground/src/waeup/sirp/users.py @ 11110

Last change on this file since 11110 was 4920, checked in by uli, 15 years ago

Make unit tests run again with the new package layout.

File size: 1.0 KB
Line 
1"""Users (principals) for the WAeUP portal.
2"""
3import grok
4from waeup.sirp.authentication import Account
5from waeup.sirp.interfaces import IUserContainer
6
7class UserContainer(grok.Container):
8    """A container for principals.
9
10    See interfaces.py and users.txt for extensive description.
11    """
12    grok.implements(IUserContainer)
13    grok.require('waeup.manageUsers')
14
15    def addUser(self, name, password, title=None, description=None, roles=[]):
16        """Add a new Account instance, created from parameters.
17        """
18        if title is None:
19            title = name
20        if description is None:
21            description = title
22        self[name] = Account(name, password, title, description, roles)
23
24    def addAccount(self, account):
25        """Add the account passed.
26        """
27        self[account.name] = account
28       
29    def delUser(self, name):
30        """Delete user, if an account with the given name exists.
31
32        Do not complain, if the name does not exist.
33        """
34        if name in self.keys():
35            del self[name]
Note: See TracBrowser for help on using the repository browser.