from Products.BTreeFolder2.BTreeFolder2 import BTreeFolder2 from zope.interface import implements from Globals import Persistent, InitializeClass from interfaces import IUsers from AccessControl import ClassSecurityInfo class Users(Persistent, BTreeFolder2): """ container for user objects """ implements(IUsers) meta_type = "Users" id = 'users' security = ClassSecurityInfo() def __init__(self): BTreeFolder2.__init__(self, self.id) def getUserByEmail(self, email): for x in self.objectValues('User'): if x.getEmail() == email: return x return None def getUserByUsername(self, uname): return getattr(self, uname, None) InitializeClass(Users)