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

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

Now we have a configuration object and can provide ContactAdminForm? with proper credentials for a smtp server.

Add Email address to IAccount objects so that 'From' fields in emails, sent by users, can be automatically filled.

  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1## $Id: userscontainer.py 7221 2011-11-27 06:50:43Z henrik $
2##
3## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18"""Users container for the WAeUP portal.
19"""
20import grok
21from zope.event import notify
22from waeup.sirp.authentication import Account
23from waeup.sirp.interfaces import IUsersContainer
24
25class UsersContainer(grok.Container):
26    """A container for principals.
27
28    See interfaces.py and users.txt for extensive description.
29    """
30    grok.implements(IUsersContainer)
31    grok.require('waeup.manageUsers')
32
33    def addUser(self, name, password, title=None,
34                description=None, email=None, roles=[]):
35        """Add a new Account instance, created from parameters.
36        """
37        if title is None:
38            title = name
39        #if description is None:
40        #    description = title
41        self[name] = Account(name, password, title, description, email, roles)
42
43    def addAccount(self, account):
44        """Add the account passed.
45        """
46        self[account.name] = account
47
48    def delUser(self, name):
49        """Delete user, if an account with the given name exists.
50
51        Do not complain, if the name does not exist.
52        """
53        if name in self.keys():
54            del self[name]
Note: See TracBrowser for help on using the repository browser.