source: waeup/trunk/src/waeup/users.py @ 4980

Last change on this file since 4980 was 4789, checked in by uli, 15 years ago

Merge changes from ulif-layout back into trunk (finally).

File size: 1.0 KB
RevLine 
[4111]1"""Users (principals) for the WAeUP portal.
[4089]2"""
3import grok
4from waeup.authentication import Account
[4636]5from waeup.interfaces import IUserContainer
[4089]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
[4634]15    def addUser(self, name, password, title=None, description=None, roles=[]):
[4638]16        """Add a new Account instance, created from parameters.
17        """
[4089]18        if title is None:
19            title = name
20        if description is None:
21            description = title
[4634]22        self[name] = Account(name, password, title, description, roles)
[4089]23
24    def addAccount(self, account):
[4638]25        """Add the account passed.
26        """
[4089]27        self[account.name] = account
28       
29    def delUser(self, name):
[4638]30        """Delete user, if an account with the given name exists.
31
32        Do not complain, if the name does not exist.
33        """
[4089]34        if name in self.keys():
35            del self[name]
Note: See TracBrowser for help on using the repository browser.