From 178ca598fedc4411017861fe4fe38c6a22617aa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Volkan=20=C5=9Eahin?= Date: Mon, 27 Jun 2016 17:11:48 +0300 Subject: [PATCH] user display and desktop manager is storing in db --- opt/ahenk/base/system/system.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/opt/ahenk/base/system/system.py b/opt/ahenk/base/system/system.py index dd20e21..3def19e 100644 --- a/opt/ahenk/base/system/system.py +++ b/opt/ahenk/base/system/system.py @@ -12,9 +12,15 @@ import socket import fcntl import struct from uuid import getnode as get_mac +from base.Scope import Scope class System: + def __init__(self): + scope = Scope().getInstance() + self.db_service = scope.getDbService() + self.logger = scope.getLogger() + class Ahenk(object): @staticmethod @@ -187,12 +193,17 @@ class System: def user_details(): return psutil.users() - + @staticmethod + def display(username): + system = System() + display = system.db_service.select_one_result('session', 'display', " username='{0}'".format(username)) + return display @staticmethod - def last_login_username(): - # TODO - pass + def desktop(username): + system = System() + desktop = system.db_service.select_one_result('session', 'desktop', " username='{0}'".format(username)) + return desktop class Os(object):