source: main/waeup.sirp/trunk/src/waeup/sirp/userscontainer.py @ 7175

Last change on this file since 7175 was 7172, checked in by Henrik Bettermann, 13 years ago

Rename UserContainer? to UsersContainer? to be in line with ApplicantsContainer?, StudentsContainer?, HostelsCointainer?, PaymentsContainer?. In other words, a userscontainer contains users and it's not the container of a user. This is not really necessary in terms of English grammar but it helps to confuse container types.

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