"""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]