From 0e42e83c502870937c3b31d77ca3c6ed6a163cd8 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Sun, 13 Mar 2016 18:43:57 -0400 Subject: [PATCH] Restore intended per-user ssh sessions Each user should have their own ssh sessions, as originally intended. --- confluent_server/confluent/shellserver.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/confluent_server/confluent/shellserver.py b/confluent_server/confluent/shellserver.py index 6dea5345..0db17fb6 100644 --- a/confluent_server/confluent/shellserver.py +++ b/confluent_server/confluent/shellserver.py @@ -95,18 +95,18 @@ class ShellSession(consoleserver.ConsoleSession): global activesessions tenant = self.configmanager.tenant if (self.configmanager.tenant, self.node) not in activesessions: - activesessions[(tenant, self.node)] = {} + activesessions[(tenant, self.node, self.username)] = {} if self.sessionid is None: self.sessionid = 1 - while str(self.sessionid) in activesessions[(tenant, self.node)]: + while str(self.sessionid) in activesessions[(tenant, self.node, self.username)]: self.sessionid += 1 self.sessionid = str(self.sessionid) - if self.sessionid not in activesessions[(tenant, self.node)]: - activesessions[(tenant, self.node)][self.sessionid] = _ShellHandler(self.node, self.configmanager) - self.conshdl = activesessions[(self.configmanager.tenant, self.node)][self.sessionid] + if self.sessionid not in activesessions[(tenant, self.node, self.username)]: + activesessions[(tenant, self.node, self.username)][self.sessionid] = _ShellHandler(self.node, self.configmanager) + self.conshdl = activesessions[(self.configmanager.tenant, self.node, self.username)][self.sessionid] def destroy(self): - del activesessions[(self.configmanager.tenant, self.node)][self.sessionid] + del activesessions[(self.configmanager.tenant, self.node, self.username)][self.sessionid] super(ShellSession, self).destroy() def create(nodes, element, configmanager, inputdata): @@ -117,6 +117,6 @@ def create(nodes, element, configmanager, inputdata): def retrieve(nodes, element, configmanager, inputdata): tenant = configmanager.tenant user = configmanager.current_user - if (tenant, nodes[0]) in activesessions: - for sessionid in activesessions[(tenant, nodes[0])]: + if (tenant, nodes[0], user) in activesessions: + for sessionid in activesessions[(tenant, nodes[0], user)]: yield msg.ChildCollection(sessionid)