1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-08 21:18:00 +03:00

Added new "on logout" state

This commit is contained in:
Adolfo Gómez García 2018-03-05 13:38:40 +01:00
parent df98efc2da
commit b37c87afb5
3 changed files with 15 additions and 12 deletions

View File

@ -48,7 +48,8 @@ import logging
logger = logging.getLogger(__name__)
__updated__ = '2016-02-26'
__updated__ = '2018-03-05'
@python_2_unicode_compatible
class Authenticator(ManagedObjectModel, TaggingMixin):
@ -137,10 +138,9 @@ class Authenticator(ManagedObjectModel, TaggingMixin):
'''
if realName is None:
realName = username
realName = realName if realName is None else username
user, _ = self.users.get_or_create(name=username, defaults={'real_name': realName, 'last_access': NEVER, 'state': State.ACTIVE})
if realName is not None and realName != user.real_name:
if user.real_name.strip() == '' and realName != user.real_name:
user.real_name = realName
user.save()
@ -205,5 +205,6 @@ class Authenticator(ManagedObjectModel, TaggingMixin):
def __str__(self):
return u"{0} of type {1} (id:{2})".format(self.name, self.data_type, self.id)
# Connects a pre deletion signal to Authenticator
signals.pre_delete.connect(Authenticator.beforeDelete, sender=Authenticator)

View File

@ -56,13 +56,14 @@ class LinuxOsManager(osmanagers.OSManager):
servicesType = (serviceTypes.VDI,)
onLogout = gui.ChoiceField(
label=_('On Logout'),
label=_('Logout Action'),
order=10,
rdonly=True,
tooltip=_('What to do when user logs out from service'),
values=[
{'id': 'keep', 'text': _('Keep service assigned')},
{'id': 'remove', 'text': _('Remove service')}
{'id': 'remove', 'text': _('Remove service')},
{'id': 'keep-always', 'text': _('Keep service assigned even on new publication')},
],
defvalue='keep')
@ -71,7 +72,7 @@ class LinuxOsManager(osmanagers.OSManager):
length=4,
defvalue=-1,
rdonly=False, order=11,
tooltip=_('Maximum idle time (in seconds) before session is automaticatlly closed to the user (<= 0 means no max idle time).'),
tooltip=_('Maximum idle time (in seconds) before session is automatically closed to the user (<= 0 means no max idle time).'),
required=True)
def __setProcessUnusedMachines(self):
@ -198,7 +199,7 @@ class LinuxOsManager(osmanagers.OSManager):
userService.remove()
def isPersistent(self):
return not self._onLogout == 'remove'
return not self._onLogout == 'keep-always'
def checkState(self, service):
logger.debug('Checking state for service {0}'.format(service))

View File

@ -47,13 +47,14 @@ class WindowsOsManager(osmanagers.OSManager):
servicesType = (serviceTypes.VDI,)
onLogout = gui.ChoiceField(
label=_('On Logout'),
label=_('Logout Action'),
order=10,
rdonly=True,
tooltip=_('What to do when user logs out from service'),
values=[
{'id': 'keep', 'text': _('Keep service assigned')},
{'id': 'remove', 'text': _('Remove service')}
{'id': 'remove', 'text': _('Remove service')},
{'id': 'keep-always', 'text': _('Keep service assigned even on new publication')},
],
defvalue='keep'
)
@ -64,7 +65,7 @@ class WindowsOsManager(osmanagers.OSManager):
defvalue=-1,
rdonly=False,
order=11,
tooltip=_('Maximum idle time (in seconds) before session is automaticatlly closed to the user (<= 0 means no max. idle time)'),
tooltip=_('Maximum idle time (in seconds) before session is automatically closed to the user (<= 0 means no max. idle time)'),
required=True
)
@ -216,7 +217,7 @@ class WindowsOsManager(osmanagers.OSManager):
userService.remove()
def isPersistent(self):
return not self._onLogout == 'remove'
return not self._onLogout == 'keep-always'
def checkState(self, service):
logger.debug('Checking state for service {0}'.format(service))