def info(self, code, instanceDatum='', supplementaryDatum=''): """Log an info event to the audit trail. * Creates an ID for the new event, * Writes the instantiated event to the audit-table, and * Writes the event to the standard Python log.""" d = datetime.now(UTC) if self.userInfo: ed = '{0}-{1}-{2}-{4}-{5}-{6}-{7}-{8}' eventId = to_id(ed.format( self.groupInfo.name, self.groupInfo.id, d, self.siteInfo.name, self.siteInfo.id, instanceDatum, self.userInfo.name, self.userInfo.id, supplementaryDatum)) else: ed = '{0}-{1}-{2}-{4}-{5}-{6}' eventId = to_id(ed.format( self.groupInfo.name, self.groupInfo.id, d, self.siteInfo.name, self.siteInfo.id, instanceDatum, supplementaryDatum)) e = self.factory( self.context, eventId, code, d, self.userInfo, self.userInfo, self.siteInfo, self.groupInfo, instanceDatum, supplementaryDatum, SUBSYSTEM) self.queries.store(e) log.info(e) return e
def create_request_id(self, fromAddress, message): istr = fromAddress + message + self.userInfo.id + \ self.userInfo.name + self.groupInfo.id + self.groupInfo.name + \ self.siteInfo.id + self.siteInfo.name retval = to_id(istr) assert retval return retval
def create_request_id(self, fromAddress, message): istr = fromAddress + message + self.userInfo.id + \ self.userInfo.name + self.groupInfo.id + self.groupInfo.name + \ self.siteInfo.id + self.siteInfo.name retval = to_id(istr) assert retval return retval
def info(self, code, instanceDatum=''): d = curr_time() eventId = to_id(code, instanceDatum) e = self.factory(self.context, eventId, code, d, None, None, self.siteInfo, None, instanceDatum, None, SUBSYSTEM) self.queries.store(e) log.info(e)
def get_password_reset(self, userInfo, email): resetId = to_id(email + userInfo.name + self.siteInfo.name) passwordUser = IGSPasswordUser(userInfo) passwordUser.add_password_reset(resetId) u = '{siteUrl}/r/password/{resetId}' retval = u.format(siteUrl=self.siteInfo.url, resetId=resetId) assert retval return retval
def get_password_reset(self, userInfo, email): resetId = to_id(email + userInfo.name + self.siteInfo.name) passwordUser = IGSPasswordUser(userInfo) passwordUser.add_password_reset(resetId) u = '{siteUrl}/r/password/{resetId}' retval = u.format(siteUrl=self.siteInfo.url, resetId=resetId) assert retval return retval
def info(self, code, recipientUserInfo=None, instanceDatum=''): d = datetime.now(UTC) s = code + repr(recipientUserInfo) + instanceDatum + d.isoformat() eventId = to_id(s) e = self.factory(self.context, eventId, code, d, None, recipientUserInfo, None, None, instanceDatum, None, SUBSYSTEM) self.queries.store(e) log.info(e)
def info(self, code, recipientUserInfo=None, instanceDatum=''): d = datetime.now(UTC) s = code + repr(recipientUserInfo) + instanceDatum + d.isoformat() eventId = to_id(s) e = self.factory( self.context, eventId, code, d, None, recipientUserInfo, None, None, instanceDatum, None, SUBSYSTEM) self.queries.store(e) log.info(e)
def event_id_from_data(userInfo, instanceUserInfo, siteInfo, code, instanceDatum, supplementaryDatum): iD = instanceDatum if instanceDatum else '' sD = supplementaryDatum if supplementaryDatum else '' e = '{}-{} {}-{} {}-{} {} {} {} {}'.format( to_unicode_or_bust(userInfo.name), userInfo.id, to_unicode_or_bust(instanceUserInfo.name), instanceUserInfo.id, to_unicode_or_bust(siteInfo.name), siteInfo.id, datetime.now(UTC), code, to_unicode_or_bust(iD), to_unicode_or_bust(sD)) r = e.encode(ascii, ignore) retval = to_id(r) return retval
def get_password_reset(self, userInfo, email): # FIXME: cut 'n' paste software engineering from # gs.group.member.add.base s = asctime() + email + userInfo.name + self.siteInfo.name resetId = to_id(s) passwordUser = IGSPasswordUser(userInfo) passwordUser.add_password_reset(resetId) u = '{siteUrl}/r/password/{resetId}' retval = u.format(siteUrl=self.siteInfo.url, resetId=resetId) assert retval return retval
def get_password_reset(self, userInfo, email): # FIXME: cut 'n' paste software engineering from # gs.group.member.add.base s = asctime() + email + userInfo.name + self.siteInfo.name resetId = to_id(s) passwordUser = IGSPasswordUser(userInfo) passwordUser.add_password_reset(resetId) u = '{siteUrl}/r/password/{resetId}' retval = u.format(siteUrl=self.siteInfo.url, resetId=resetId) assert retval return retval
def info(self, code, adminInfo, groupInfo=None, instanceDatum='', supplementaryDatum=''): d = now() eventId = to_id(to_unicode_or_bust(adminInfo.id) + unicode(d) + unicode(SystemRandom().randint(0, 1024)) + to_unicode_or_bust(adminInfo.name) + to_unicode_or_bust(self.siteInfo.id) + to_unicode_or_bust(self.siteInfo.name) + to_unicode_or_bust(code) + to_unicode_or_bust(instanceDatum) + to_unicode_or_bust(supplementaryDatum)) e = self.factory(self.context, eventId, code, d, adminInfo, None, self.siteInfo, groupInfo, instanceDatum, supplementaryDatum, SUBSYSTEM) self.queries.store(e) log.info(e)
def get_reset_id(self, userInfo, email): s = email + userInfo.name + self.siteInfo.name + \ self.siteInfo.get_support_email() retval = to_id(s) return retval
def generate_confirmation_id(self, email): id22 = to_id(str(email) + self.groupInfo.name + self.groupInfo.id) retval = id22[:6] return retval