mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-31 01:48:04 +03:00
fixing
This commit is contained in:
commit
4bc6d88006
@ -39,6 +39,7 @@ from uds.models import DeployedService
|
||||
from uds.models import Transport
|
||||
from uds.models import TicketStore
|
||||
from uds.core.util.model import processUuid
|
||||
from uds.core.util import tools
|
||||
|
||||
import datetime
|
||||
import six
|
||||
@ -47,7 +48,7 @@ import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
VALID_PARAMS = ('authId', 'authTag', 'authSmallName', 'auth', 'username', 'realname', 'password', 'groups', 'servicePool', 'transport', 'force')
|
||||
VALID_PARAMS = ('authId', 'authTag', 'authSmallName', 'auth', 'username', 'realname', 'password', 'groups', 'servicePool', 'transport', 'force', 'userIp')
|
||||
|
||||
|
||||
# Enclosed methods under /actor path
|
||||
@ -122,6 +123,8 @@ class Tickets(Handler):
|
||||
|
||||
force = self._params.get('force', '0') in ('1', 'true', 'True')
|
||||
|
||||
userIp = self._params.get('userIp', None)
|
||||
|
||||
try:
|
||||
authId = self._params.get('authId', None)
|
||||
authTag = self._params.get('authTag', self._params.get('authSmallName', None))
|
||||
@ -177,13 +180,21 @@ class Tickets(Handler):
|
||||
logger.error('Transport {} is not valid for Service Pool {}'.format(transport.name, servicePool.name))
|
||||
raise Exception('Invalid transport for Service Pool')
|
||||
else:
|
||||
transport = servicePool.transports.order_by('priority').first()
|
||||
if transport is None:
|
||||
logger.error('Service pool {} does not has transports')
|
||||
raise Exception('Service pool does not has any assigned transports')
|
||||
if userIp is None:
|
||||
transport = tools.DictAsObj({'uuid': None})
|
||||
else:
|
||||
transport = None
|
||||
for v in servicePool.transports.order_by('priority'):
|
||||
if v.validForIp(userIp):
|
||||
transport = v
|
||||
break
|
||||
|
||||
if transport is None:
|
||||
logger.error('Service pool {} does not has valid transports for ip {}'.format(servicePool.name, userIp))
|
||||
raise Exception('Service pool does not has any valid transports for ip {}'.format(userIp))
|
||||
|
||||
servicePool = servicePool.uuid
|
||||
transport = transport.uuid
|
||||
transport = transport.uuid # pylint: disable=maybe-no-member
|
||||
|
||||
except Authenticator.DoesNotExist:
|
||||
return Tickets.result(error='Authenticator does not exists')
|
||||
|
@ -51,7 +51,7 @@ import requests
|
||||
import json
|
||||
import logging
|
||||
|
||||
__updated__ = '2015-10-24'
|
||||
__updated__ = '2015-11-05'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -139,9 +139,9 @@ class UserServiceOpChecker(DelayedTask):
|
||||
@param pi: Instance of Publication manager for the object
|
||||
'''
|
||||
# Do not add task if already exists one that updates this service
|
||||
if DelayedTaskRunner.runner().checkExists(USERSERVICE_TAG + userService.uuid):
|
||||
if DelayedTaskRunner.runner().checkExists(USERSERVICE_TAG + str(userService.id)):
|
||||
return
|
||||
DelayedTaskRunner.runner().insert(UserServiceOpChecker(userService), ci.suggestedTime, USERSERVICE_TAG + userService.uuid)
|
||||
DelayedTaskRunner.runner().insert(UserServiceOpChecker(userService), ci.suggestedTime, USERSERVICE_TAG + str(userService.id))
|
||||
|
||||
def run(self):
|
||||
logger.debug('Checking user service finished {0}'.format(self._svrId))
|
||||
@ -325,9 +325,8 @@ class UserServiceManager(object):
|
||||
Removes a uService element
|
||||
@return: the uService removed (marked for removal)
|
||||
'''
|
||||
uService.refresh_from_db()
|
||||
# uService = UserService.objects.get(id=uService.id)
|
||||
logger.debug('Removing uService {}'.format(uService))
|
||||
uService = UserService.objects.get(id=uService.id)
|
||||
logger.debug('Removing uService {0}'.format(uService))
|
||||
if uService.isUsable() is False and State.isRemovable(uService.state) is False:
|
||||
raise OperationException(_('Can\'t remove a non active element'))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user