## $Id: userscontainer.py 7197 2011-11-25 08:32:43Z henrik $ ## ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## """Users container for the WAeUP portal. """ import grok from zope.event import notify from waeup.sirp.authentication import Account from waeup.sirp.interfaces import IUsersContainer class UsersContainer(grok.Container): """A container for principals. See interfaces.py and users.txt for extensive description. """ grok.implements(IUsersContainer) grok.require('waeup.manageUsers') def addUser(self, name, password, title=None, description=None, roles=[]): """Add a new Account instance, created from parameters. """ if title is None: title = name #if description is None: # description = title self[name] = Account(name, password, title, description, roles) def addAccount(self, account): """Add the account passed. """ self[account.name] = account def delUser(self, name): """Delete user, if an account with the given name exists. Do not complain, if the name does not exist. """ if name in self.keys(): del self[name]