mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-11 05:17:55 +03:00
Merged 2.0 fixes
This commit is contained in:
commit
7fc9adae8b
@ -37,9 +37,12 @@ from uds.core.services import types as serviceTypes
|
||||
from uds.core.util.State import State
|
||||
from uds.core.util.stats.events import addEvent, ET_LOGIN, ET_LOGOUT
|
||||
from uds.core.util import log
|
||||
from uds.core.util.Config import GlobalConfig
|
||||
from uds.core import Module
|
||||
|
||||
__updated__ = '2016-09-16'
|
||||
import six
|
||||
|
||||
__updated__ = '2016-09-19'
|
||||
|
||||
STORAGE_KEY = 'osmk'
|
||||
|
||||
@ -202,6 +205,9 @@ class OSManager(Module):
|
||||
|
||||
log.useLog('login', uniqueId, serviceIp, userName, knownUserIP, fullUserName)
|
||||
|
||||
counter = int(userService.getProperty('loginsCounter', '0')) + 1
|
||||
userService.setProperty(six.text_type(counter))
|
||||
|
||||
if save:
|
||||
userService.save()
|
||||
|
||||
@ -212,6 +218,15 @@ class OSManager(Module):
|
||||
- Sets service in use
|
||||
- Invokes userLoggedIn for user service instance
|
||||
'''
|
||||
counter = int(userService.getProperty('loginsCounter', '0'))
|
||||
if counter > 0:
|
||||
counter -= 1
|
||||
userService.setProperty(six.text_type(counter))
|
||||
|
||||
if GlobalConfig.EXCLUSIVE_LOGOUT.getBool(True) is True:
|
||||
if counter > 0:
|
||||
return
|
||||
|
||||
uniqueId = userService.unique_id
|
||||
userService.setInUse(False)
|
||||
si = userService.getInstance()
|
||||
|
@ -296,6 +296,9 @@ class GlobalConfig(object):
|
||||
# If there is a proxy in front of us
|
||||
BEHIND_PROXY = Config.section(SECURITY_SECTION).value('Behind a proxy', '0', type=Config.BOOLEAN_FIELD)
|
||||
|
||||
# If we use new logout mechanics
|
||||
EXCLUSIVE_LOGOUT = Config.section(SECURITY_SECTION).value('Exclusive Logout', '0', type=Config.BOOLEAN_FIELD)
|
||||
|
||||
# Clusters related vars
|
||||
|
||||
# Maximum desired CPU Load. If cpu is over this value, a migration of a service is "desirable"
|
||||
|
@ -164,7 +164,7 @@ class LinuxOsManager(osmanagers.OSManager):
|
||||
ret = "{0}\t{1}\t{2}".format(ip, hostname, 0 if deadLine is None else deadLine)
|
||||
elif msg == "logout":
|
||||
self.loggedOut(userService, data, False)
|
||||
if self._onLogout == 'remove':
|
||||
if userService.in_use == False and self._onLogout == 'remove':
|
||||
doRemove = True
|
||||
elif msg == "ip":
|
||||
# This ocurss on main loop inside machine, so userService is usable
|
||||
|
@ -177,7 +177,7 @@ class WindowsOsManager(osmanagers.OSManager):
|
||||
ret = "{0}\t{1}".format(ip, hostname)
|
||||
elif msg == "logoff" or msg == 'logout':
|
||||
self.loggedOut(userService, data, False)
|
||||
if self._onLogout == 'remove':
|
||||
if userService.in_use == False and self._onLogout == 'remove':
|
||||
doRemove = True
|
||||
elif msg == "ip":
|
||||
# This ocurss on main loop inside machine, so userService is usable
|
||||
|
Loading…
Reference in New Issue
Block a user