1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

Merge remote-tracking branch 'origin/v2.1'

This commit is contained in:
Adolfo Gómez García 2017-06-20 08:18:36 +02:00
commit 876e9ee3b5
4 changed files with 27 additions and 10 deletions

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012 Virtual Cable S.L.
# Copyright (c) 2012-2017 Virtual Cable S.L.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
@ -40,7 +40,7 @@ from uds.models import UserService
import logging
__updated__ = '2017-05-18'
__updated__ = '2017-06-15'
logger = logging.getLogger(__name__)
@ -148,10 +148,18 @@ class UpdateFromPreparing(StateUpdater):
class UpdateFromRemoving(StateUpdater):
def finish(self):
osManager = self.userServiceInstance.osmanager()
if osManager is not None:
osManager.release(self.userService)
self.save(State.REMOVED)
class UpdateFromCanceling(StateUpdater):
def finish(self):
osManager = self.userServiceInstance.osmanager()
if osManager is not None:
osManager.release(self.userService)
self.save(State.CANCELED)
class UpdateFromOther(StateUpdater):

View File

@ -53,7 +53,7 @@ class WinDomainOsManager(WindowsOsManager):
if values['password'] == '':
raise osmanagers.OSManager.ValidationException(_('Must provide a password for the account!'))
self._domain = values['domain']
self._ou = values['ou']
self._ou = values['ou'].strip()
self._account = values['account']
self._password = values['password']
else:
@ -121,6 +121,10 @@ class WinDomainOsManager(WindowsOsManager):
'''
super(WinDomainOsManager, self).release(service)
if not '.' in self._domain:
logger.info('Releasing from a not FQDN domain is not supported')
return
try:
l = self.__connectLdap()
except dns.resolver.NXDOMAIN: # No domain found, log it and pass
@ -130,14 +134,19 @@ class WinDomainOsManager(WindowsOsManager):
logger.exception('Ldap Exception caught')
log.doLog(service, log.WARN, "Could not remove machine from domain (invalid credentials for {0})".format(self._account), log.OSMANAGER)
# _filter = '(&(objectClass=computer)(sAMAccountName=%s$))' % service.friendly_name
try:
# res = l.search_ext_s(base = self._ou, scope = ldap.SCOPE_SUBTREE,
# filterstr = _filter)[0]
l.delete('cn={0},{1}'.format(service.friendly_name, self._ou))
if self._ou:
ou = self._ou
else:
ou = ','.join(['DC=' + i for i in self._domain.split('.')])
fltr = '(&(objectClass=computer)(sAMAccountName={}$))'.format(service.friendly_name)
res = l.search_ext_s(base=ou, scope=ldap.SCOPE_SUBTREE, filterstr=fltr)[0]
l.delete_s(res[0]) # Remove by DN, SYNC
except IndexError:
logger.error('Error deleting {} from BASE {}'.format(service.friendly_name, ou))
except Exception:
logger.exception('Not found: ')
logger.exception('Deleting from AD: ')
def check(self):
try:

View File

@ -14,7 +14,7 @@ gui.calendars.link = ->
return
freqDct =
'DAILY': [gettext('day'), gettext('days'), gettext('Dayly')]
'DAILY': [gettext('day'), gettext('days'), gettext('Daily')]
'WEEKLY': [gettext('week'), gettext('weeks'), gettext('Weekly')]
'MONTHLY': [gettext('month'), gettext('months'), gettext('Monthly')]
'YEARLY': [gettext('year'), gettext('years'), gettext('Yearly')]
@ -45,7 +45,6 @@ gui.calendars.link = ->
return gettext("(no days)")
return res.join(', ')
renderer = (fld, data, type, record) ->
# Display "custom" fields of rules table
if fld == "interval"

View File

@ -255,6 +255,7 @@ gui.providers.link = (event) ->
gui.tools.unblockUI()
return
)
prevTables.push usageTable
return