def setUp(self): """ Create a store with a LoginSystem and a portal wrapped around it. """ self.store = store.Store() installOn(userbase.LoginSystem(store=self.store), self.store) realm = portal.IRealm(self.store) checker = checkers.ICredentialsChecker(self.store) self.portal = portal.Portal(realm, [checker])
def postOptions(self): s = self.parent.parent.getStore() ss = portal.IRealm(s).accountByAddress(u'mantissa', None).avatars.open() for obs in ss.query( stats.RemoteStatsObserver, AND(stats.RemoteStatsObserver.hostname == self['host'], stats.RemoteStatsObserver.port == int(self['port']))): obs.deleteFromStore()
def installAdmin(self, s, username, domain, password): # Add an account for our administrator, so they can log in through the # web. r = portal.IRealm(s) try: acc = r.addAccount(username, domain, password, internal=True, verified=True) except eaxiom.DuplicateUser: acc = r.accountByAddress(username, domain) accStore = acc.avatars.open() accStore.transact(webadmin.endowAdminPowerups, accStore)
def postOptions(self): s = self.parent.getStore() s.findOrCreate(userbase.LoginSystem, lambda i: installOn(i, s)) for ws in s.query(website.WebSite): break else: ws = website.WebSite(store=s, portNumber=8080, securePortNumber=8443, certificateFile='server.pem') installOn(ws, s) if not os.path.exists('server.pem'): certcreate.main([]) #Is there a real way to do this? u = portal.IRealm(s).addAccount(u'confession', self['domain'], u'no password :(') us = u.avatars.open() installOn(confession.AnonConfessionUser(store=us), us) installOn( confession.ConfessionDispatcher(store=us, localHost=self['domain']), us)
def postOptions(self): s = self.parent.parent.getStore() ss = portal.IRealm(s).accountByAddress(u'mantissa', None).avatars.open() for i, obs in enumerate(ss.query(stats.RemoteStatsObserver)): print "%s) %s:%s" % (i, obs.hostname, obs.port)
def installCollector(self, s, host, port): ss = portal.IRealm(s).accountByAddress(u'mantissa', None).avatars.open() stats.RemoteStatsObserver(store=ss, hostname=host, port=port)
def getMessageDelivery(self): realm = portal.IRealm(self.store.parent) chk = checkers.ICredentialsChecker(self.store.parent) return AuthenticatedMessageDelivery( iquotient.IMIMEDelivery(self.store), iquotient.IMessageSender(self.store))