some cleanup
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Torma Kristóf 2021-04-25 17:09:37 +02:00
parent 904c01db47
commit e3d1280cb6
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047

View File

@ -5,22 +5,18 @@ from executor import Executor
class Server: class Server:
def __init__(self, homeDirectory: str = "", sessionTimeout: int = 120, availableServer: bool = True, def __init__(self, homeDirectory: str = "", sessionTimeout: int = 120, availableServer: bool = True):
currentDirectory: str = ""):
self.isAuthenticated = False self.isAuthenticated = False
self.homeDirectory = homeDirectory self.homeDirectory = homeDirectory
self.sessionTimeout = sessionTimeout self.sessionTimeout = sessionTimeout
self.availableServer = availableServer self.availableServer = availableServer
if currentDirectory == "":
self.currentDirectory = homeDirectory
else:
self.currentDirectory = currentDirectory
self.executor = Executor(homeDirectory) self.executor = Executor(homeDirectory)
def login(self, username: str, password: str) -> bool: def login(self, username: str, password: str) -> bool:
auth = Authetication() auth = Authetication()
self.isAuthenticated = True self.isAuthenticated = True
home_directory = auth.login(username, password) home_directory = auth.login(username, password)
self.executor.baseDir=Executor(home_directory)
if not home_directory: if not home_directory:
return False return False
else: else:
@ -30,7 +26,7 @@ class Server:
self.isAuthenticated = False self.isAuthenticated = False
self.availableServer = False self.availableServer = False
self.homeDirectory = "" self.homeDirectory = ""
self.currentDirectory = "" self.executor.baseDir=Executor(self.homeDirectory)
def parseCommand(self, command: str) -> str: def parseCommand(self, command: str) -> str:
parsedCommand = command.split(" ") parsedCommand = command.split(" ")