def __init__(self, username): avatar.ConchUser.__init__(self) self.username = username self.listeners={} self.pubkey = PublicKeyCredentialsChecker.instance.getKey(username) self.isannon = PublicKeyCredentialsChecker.instance.isAnnon(username) self.channelLookup.update({ 'session':session.SSHSession, 'direct-tpcip': openConnectForwardingClient }) if self.isannon: if config["ANNONYMOUS_TIMEOUT"] > 0: repeater=LoopingCall(AnnonTimeout, user=self) repeater.kw['loop']=repeater repeater.start(config["ANNONYMOUS_TIMEOUT"]*MINUTES, now=False) if not database.getUser(key=self.pubkey): database.createUser(key=self.pubkey, username=self.username, enabled=not self.isannon) # log user logged in database.updateUserLastLogin(key=self.pubkey) ForwardUser.loggedin[self]=time()
def __init__(self, username): avatar.ConchUser.__init__(self) self.username = username self.listeners = {} self.pubkey = PublicKeyCredentialsChecker.instance.getKey(username) self.isannon = PublicKeyCredentialsChecker.instance.isAnnon(username) self.channelLookup.update({ 'session': session.SSHSession, 'direct-tpcip': openConnectForwardingClient }) if self.isannon: if config["ANNONYMOUS_TIMEOUT"] > 0: repeater = LoopingCall(AnnonTimeout, user=self) repeater.kw['loop'] = repeater repeater.start(config["ANNONYMOUS_TIMEOUT"] * MINUTES, now=False) if not database.getUser(key=self.pubkey): database.createUser(key=self.pubkey, username=self.username, enabled=not self.isannon) # log user logged in database.updateUserLastLogin(key=self.pubkey) ForwardUser.loggedin[self] = time()
def render_POST(self, request): key=self.user['key'] if 'delete' in request.args: return self.deleteUser() database.updateUserName(key, request.args['user'][0]) if 'enabled' in request.args and request.args['enabled'][0].lower()=='on': database.enableUser(key) else: database.disableUser(key) database.updateUserLastLogin(key, request.args['lastlogin'][0]) return REDIRECT % {'title': "User Updated", 'text': "User Updated"}
def render_POST(self, request): key = self.user['key'] if 'delete' in request.args: return self.deleteUser() database.updateUserName(key, request.args['user'][0]) if 'enabled' in request.args and request.args['enabled'][0].lower( ) == 'on': database.enableUser(key) else: database.disableUser(key) database.updateUserLastLogin(key, request.args['lastlogin'][0]) return REDIRECT % {'title': "User Updated", 'text': "User Updated"}