mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-25 06:03:51 +03:00
UDS 3.0 will be only python 3 compatible. We have upgrade django to 2.x, so we need python 3 to use it
This commit is contained in:
parent
96721487de
commit
1ea2054d60
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<?eclipse-pydev version="1.0"?><pydev_project>
|
<?eclipse-pydev version="1.0"?><pydev_project>
|
||||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
|
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">python3.5</pydev_property>
|
||||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
|
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 3.0</pydev_property>
|
||||||
<pydev_variables_property name="org.python.pydev.PROJECT_VARIABLE_SUBSTITUTION">
|
<pydev_variables_property name="org.python.pydev.PROJECT_VARIABLE_SUBSTITUTION">
|
||||||
<key>DJANGO_MANAGE_LOCATION</key>
|
<key>DJANGO_MANAGE_LOCATION</key>
|
||||||
<value>src/manage.py</value>
|
<value>src/manage.py</value>
|
||||||
|
@ -34,7 +34,7 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from django.core.urlresolvers import reverse
|
from django.urls import reverse
|
||||||
from uds.REST import Handler
|
from uds.REST import Handler
|
||||||
from uds.REST import RequestError
|
from uds.REST import RequestError
|
||||||
from uds.models import TicketStore
|
from uds.models import TicketStore
|
||||||
|
@ -41,5 +41,5 @@ from uds.core.BaseModule import Module
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
VERSION = '2.x.x-DEVEL'
|
VERSION = '3.x.x-DEVEL'
|
||||||
VERSION_STAMP = '{}-DEVEL'.format(time.strftime("%Y%m%d"))
|
VERSION_STAMP = '{}-DEVEL'.format(time.strftime("%Y%m%d"))
|
||||||
|
@ -39,7 +39,7 @@ from uds.core.auths.GroupsManager import GroupsManager
|
|||||||
from uds.core.auths.Exceptions import InvalidUserException
|
from uds.core.auths.Exceptions import InvalidUserException
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
__updated__ = '2018-01-16'
|
__updated__ = '2018-02-12'
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ class Authenticator(Module):
|
|||||||
if self.isExternalSource:
|
if self.isExternalSource:
|
||||||
groupsManager = GroupsManager(self._dbAuth)
|
groupsManager = GroupsManager(self._dbAuth)
|
||||||
self.getGroups(user.name, groupsManager)
|
self.getGroups(user.name, groupsManager)
|
||||||
user.groups = [g.dbGroup() for g in groupsManager.getValidGroups()]
|
user.groups.set([g.dbGroup() for g in groupsManager.getValidGroups()])
|
||||||
|
|
||||||
def callbackUrl(self):
|
def callbackUrl(self):
|
||||||
"""
|
"""
|
||||||
|
@ -63,7 +63,7 @@ class Cache(object):
|
|||||||
|
|
||||||
def get(self, skey, defValue=None):
|
def get(self, skey, defValue=None):
|
||||||
now = getSqlDatetime()
|
now = getSqlDatetime()
|
||||||
# logger.debug('Requesting key "%s" for cache "%s"' % (skey, self._owner,))
|
logger.debug('Requesting key "%s" for cache "%s"' % (skey, self._owner,))
|
||||||
try:
|
try:
|
||||||
key = self.__getKey(skey)
|
key = self.__getKey(skey)
|
||||||
c = uds.models.Cache.objects.get(pk=key) # @UndefinedVariable
|
c = uds.models.Cache.objects.get(pk=key) # @UndefinedVariable
|
||||||
@ -71,8 +71,10 @@ class Cache(object):
|
|||||||
if expired:
|
if expired:
|
||||||
return defValue
|
return defValue
|
||||||
try:
|
try:
|
||||||
|
logger.debug('value: {} ----- {}'.format(c.value, encoders.decode(c.value, 'base64')))
|
||||||
val = pickle.loads(encoders.decode(c.value, 'base64'))
|
val = pickle.loads(encoders.decode(c.value, 'base64'))
|
||||||
except ValueError:
|
except Exception: # If invalid, simple do no tuse it
|
||||||
|
logger.exception('Invalid pickle from cache')
|
||||||
c.delete()
|
c.delete()
|
||||||
return defValue
|
return defValue
|
||||||
Cache.hits += 1
|
Cache.hits += 1
|
||||||
|
@ -77,6 +77,9 @@ class FileStorage(Storage):
|
|||||||
Storage.__init__(self, *args, **kwargs)
|
Storage.__init__(self, *args, **kwargs)
|
||||||
|
|
||||||
def get_valid_name(self, name):
|
def get_valid_name(self, name):
|
||||||
|
logger.debug('Name in get_valid_name: {}'.format(name))
|
||||||
|
if name is None:
|
||||||
|
return name
|
||||||
return name.replace('\\', os.path.sep)
|
return name.replace('\\', os.path.sep)
|
||||||
|
|
||||||
def _getKey(self, name):
|
def _getKey(self, name):
|
||||||
@ -88,6 +91,7 @@ class FileStorage(Storage):
|
|||||||
return 'fstor' + six.text_type(hash(self.get_valid_name(name)))
|
return 'fstor' + six.text_type(hash(self.get_valid_name(name)))
|
||||||
|
|
||||||
def _dbFileForReadOnly(self, name):
|
def _dbFileForReadOnly(self, name):
|
||||||
|
logger.debug('Name in _dbFileForReadOnly: {}'.format(name))
|
||||||
# If we have a cache, & the cache contains the object
|
# If we have a cache, & the cache contains the object
|
||||||
if self.cache is not None:
|
if self.cache is not None:
|
||||||
dbf = self.cache.get(self._getKey(name))
|
dbf = self.cache.get(self._getKey(name))
|
||||||
@ -97,6 +101,7 @@ class FileStorage(Storage):
|
|||||||
return self._dbFileForReadWrite(name)
|
return self._dbFileForReadWrite(name)
|
||||||
|
|
||||||
def _dbFileForReadWrite(self, name):
|
def _dbFileForReadWrite(self, name):
|
||||||
|
logger.debug('Name in _dbFileForReadWrite: {}'.format(name))
|
||||||
f = DBFile.objects.get(name=self.get_valid_name(name))
|
f = DBFile.objects.get(name=self.get_valid_name(name))
|
||||||
self._storeInCache(f)
|
self._storeInCache(f)
|
||||||
return f
|
return f
|
||||||
@ -114,6 +119,7 @@ class FileStorage(Storage):
|
|||||||
'modified': f.modified
|
'modified': f.modified
|
||||||
})
|
})
|
||||||
|
|
||||||
|
logger.debug('Name in _dbFileForReadWrite: {}'.format(f.name))
|
||||||
self.cache.set(self._getKey(f.name), dbf, 3600) # Cache defaults to one hour
|
self.cache.set(self._getKey(f.name), dbf, 3600) # Cache defaults to one hour
|
||||||
|
|
||||||
def _removeFromCache(self, name):
|
def _removeFromCache(self, name):
|
||||||
|
@ -99,7 +99,7 @@ class Migration(migrations.Migration):
|
|||||||
('state', models.CharField(default='P', max_length=1, db_index=True)),
|
('state', models.CharField(default='P', max_length=1, db_index=True)),
|
||||||
('state_date', models.DateTimeField()),
|
('state_date', models.DateTimeField()),
|
||||||
('revision', models.PositiveIntegerField(default=1)),
|
('revision', models.PositiveIntegerField(default=1)),
|
||||||
('deployed_service', models.ForeignKey(related_name='publications', to='uds.DeployedService')),
|
('deployed_service', models.ForeignKey(related_name='publications', to='uds.DeployedService', on_delete=models.CASCADE)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'ordering': ('publish_date',),
|
'ordering': ('publish_date',),
|
||||||
@ -116,7 +116,7 @@ class Migration(migrations.Migration):
|
|||||||
('comments', models.CharField(default='', max_length=256)),
|
('comments', models.CharField(default='', max_length=256)),
|
||||||
('is_meta', models.BooleanField(default=False, db_index=True)),
|
('is_meta', models.BooleanField(default=False, db_index=True)),
|
||||||
('groups', models.ManyToManyField(to='uds.Group')),
|
('groups', models.ManyToManyField(to='uds.Group')),
|
||||||
('manager', models.ForeignKey(related_name='groups', to='uds.Authenticator')),
|
('manager', models.ForeignKey(related_name='groups', to='uds.Authenticator', on_delete=models.CASCADE)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'ordering': ('name',),
|
'ordering': ('name',),
|
||||||
@ -203,7 +203,7 @@ class Migration(migrations.Migration):
|
|||||||
('data_type', models.CharField(max_length=128)),
|
('data_type', models.CharField(max_length=128)),
|
||||||
('data', models.TextField(default='')),
|
('data', models.TextField(default='')),
|
||||||
('comments', models.CharField(max_length=256)),
|
('comments', models.CharField(max_length=256)),
|
||||||
('provider', models.ForeignKey(related_name='services', to='uds.Provider')),
|
('provider', models.ForeignKey(related_name='services', to='uds.Provider', on_delete=models.CASCADE)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'ordering': ('name',),
|
'ordering': ('name',),
|
||||||
@ -295,7 +295,7 @@ class Migration(migrations.Migration):
|
|||||||
('is_admin', models.BooleanField(default=False)),
|
('is_admin', models.BooleanField(default=False)),
|
||||||
('last_access', models.DateTimeField(default=datetime.datetime(1972, 7, 1, 0, 0))),
|
('last_access', models.DateTimeField(default=datetime.datetime(1972, 7, 1, 0, 0))),
|
||||||
('parent', models.IntegerField(default=-1)),
|
('parent', models.IntegerField(default=-1)),
|
||||||
('manager', models.ForeignKey(related_name='users', to='uds.Authenticator')),
|
('manager', models.ForeignKey(related_name='users', to='uds.Authenticator', on_delete=models.CASCADE)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'ordering': ('name',),
|
'ordering': ('name',),
|
||||||
@ -309,7 +309,7 @@ class Migration(migrations.Migration):
|
|||||||
('module', models.CharField(max_length=32, db_index=True)),
|
('module', models.CharField(max_length=32, db_index=True)),
|
||||||
('name', models.CharField(max_length=32, db_index=True)),
|
('name', models.CharField(max_length=32, db_index=True)),
|
||||||
('value', models.CharField(max_length=128, db_index=True)),
|
('value', models.CharField(max_length=128, db_index=True)),
|
||||||
('user', models.ForeignKey(related_name='preferences', to='uds.User')),
|
('user', models.ForeignKey(related_name='preferences', to='uds.User', on_delete=models.CASCADE)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
},
|
},
|
||||||
@ -332,9 +332,9 @@ class Migration(migrations.Migration):
|
|||||||
('src_hostname', models.CharField(default='', max_length=64)),
|
('src_hostname', models.CharField(default='', max_length=64)),
|
||||||
('src_ip', models.CharField(default='', max_length=15)),
|
('src_ip', models.CharField(default='', max_length=15)),
|
||||||
('cluster_node', models.CharField(default=None, max_length=128, null=True, db_index=True, blank=True)),
|
('cluster_node', models.CharField(default=None, max_length=128, null=True, db_index=True, blank=True)),
|
||||||
('deployed_service', models.ForeignKey(related_name='userServices', to='uds.DeployedService')),
|
('deployed_service', models.ForeignKey(related_name='userServices', to='uds.DeployedService', on_delete=models.CASCADE)),
|
||||||
('publication', models.ForeignKey(related_name='userServices', blank=True, to='uds.DeployedServicePublication', null=True)),
|
('publication', models.ForeignKey(related_name='userServices', blank=True, to='uds.DeployedServicePublication', null=True, on_delete=models.CASCADE)),
|
||||||
('user', models.ForeignKey(related_name='userServices', default=None, blank=True, to='uds.User', null=True)),
|
('user', models.ForeignKey(related_name='userServices', default=None, blank=True, to='uds.User', null=True, on_delete=models.CASCADE)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'ordering': ('creation_date',),
|
'ordering': ('creation_date',),
|
||||||
@ -379,13 +379,13 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='deployedservice',
|
model_name='deployedservice',
|
||||||
name='osmanager',
|
name='osmanager',
|
||||||
field=models.ForeignKey(related_name='deployedServices', blank=True, to='uds.OSManager', null=True),
|
field=models.ForeignKey(related_name='deployedServices', blank=True, to='uds.OSManager', null=True, on_delete=models.CASCADE),
|
||||||
preserve_default=True,
|
preserve_default=True,
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='deployedservice',
|
model_name='deployedservice',
|
||||||
name='service',
|
name='service',
|
||||||
field=models.ForeignKey(related_name='deployedServices', blank=True, to='uds.Service', null=True),
|
field=models.ForeignKey(related_name='deployedServices', blank=True, to='uds.Service', null=True, on_delete=models.CASCADE),
|
||||||
preserve_default=True,
|
preserve_default=True,
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
|
@ -31,7 +31,7 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='deployedservice',
|
model_name='deployedservice',
|
||||||
name='image',
|
name='image',
|
||||||
field=models.ForeignKey(related_name='deployedServices', blank=True, to='uds.Image', null=True),
|
field=models.ForeignKey(related_name='deployedServices', blank=True, to='uds.Image', null=True, on_delete=models.CASCADE),
|
||||||
preserve_default=True,
|
preserve_default=True,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -17,7 +17,7 @@ class Migration(migrations.Migration):
|
|||||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||||
('name', models.CharField(max_length=128, db_index=True)),
|
('name', models.CharField(max_length=128, db_index=True)),
|
||||||
('value', models.TextField(default='')),
|
('value', models.TextField(default='')),
|
||||||
('user_service', models.ForeignKey(related_name='properties', to='uds.UserService')),
|
('user_service', models.ForeignKey(related_name='properties', to='uds.UserService', on_delete=models.CASCADE)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'db_table': 'uds__user_service_property',
|
'db_table': 'uds__user_service_property',
|
||||||
|
@ -21,8 +21,8 @@ class Migration(migrations.Migration):
|
|||||||
('object_type', models.SmallIntegerField(default=-1, db_index=True)),
|
('object_type', models.SmallIntegerField(default=-1, db_index=True)),
|
||||||
('object_id', models.IntegerField(default=None, null=True, db_index=True, blank=True)),
|
('object_id', models.IntegerField(default=None, null=True, db_index=True, blank=True)),
|
||||||
('permission', models.SmallIntegerField(default=0, db_index=True)),
|
('permission', models.SmallIntegerField(default=0, db_index=True)),
|
||||||
('group', models.ForeignKey(related_name='permissions', default=None, blank=True, to='uds.Group', null=True)),
|
('group', models.ForeignKey(related_name='permissions', default=None, blank=True, to='uds.Group', null=True, on_delete=models.CASCADE)),
|
||||||
('user', models.ForeignKey(related_name='permissions', default=None, blank=True, to='uds.User', null=True)),
|
('user', models.ForeignKey(related_name='permissions', default=None, blank=True, to='uds.User', null=True, on_delete=models.CASCADE)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'abstract': False,
|
'abstract': False,
|
||||||
|
@ -44,16 +44,16 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='group',
|
model_name='group',
|
||||||
name='manager',
|
name='manager',
|
||||||
field=uds.models.Util.UnsavedForeignKey(related_name='groups', to='uds.Authenticator'),
|
field=uds.models.Util.UnsavedForeignKey(related_name='groups', to='uds.Authenticator', on_delete=models.CASCADE),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='user',
|
model_name='user',
|
||||||
name='manager',
|
name='manager',
|
||||||
field=uds.models.Util.UnsavedForeignKey(related_name='users', to='uds.Authenticator'),
|
field=uds.models.Util.UnsavedForeignKey(related_name='users', to='uds.Authenticator', on_delete=models.CASCADE),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='deployedservicepublicationchangelog',
|
model_name='deployedservicepublicationchangelog',
|
||||||
name='publication',
|
name='publication',
|
||||||
field=models.ForeignKey(related_name='changelog', to='uds.DeployedService'),
|
field=models.ForeignKey(related_name='changelog', to='uds.DeployedService', on_delete=models.CASCADE),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -37,7 +37,7 @@ class Migration(migrations.Migration):
|
|||||||
('interval', models.IntegerField(default=1)),
|
('interval', models.IntegerField(default=1)),
|
||||||
('duration', models.IntegerField(default=0)),
|
('duration', models.IntegerField(default=0)),
|
||||||
('duration_unit', models.CharField(default='MINUTES', max_length=32, choices=[('MINUTES', 'Minutes'), ('HOURS', 'Hours'), ('DAYS', 'Days'), ('WEEKS', 'Weeks')])),
|
('duration_unit', models.CharField(default='MINUTES', max_length=32, choices=[('MINUTES', 'Minutes'), ('HOURS', 'Hours'), ('DAYS', 'Days'), ('WEEKS', 'Weeks')])),
|
||||||
('calendar', models.ForeignKey(related_name='rules', to='uds.Calendar')),
|
('calendar', models.ForeignKey(related_name='rules', to='uds.Calendar', on_delete=models.CASCADE)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'db_table': 'uds_calendar_rules',
|
'db_table': 'uds_calendar_rules',
|
||||||
|
@ -60,7 +60,7 @@ class AccountUsage(UUIDModel):
|
|||||||
end = models.DateTimeField(default=NEVER)
|
end = models.DateTimeField(default=NEVER)
|
||||||
user_service = models.OneToOneField(UserService, null=True, blank=True, related_name='accounting', on_delete=models.SET_NULL)
|
user_service = models.OneToOneField(UserService, null=True, blank=True, related_name='accounting', on_delete=models.SET_NULL)
|
||||||
|
|
||||||
account = models.ForeignKey(Account, related_name='usages')
|
account = models.ForeignKey(Account, related_name='usages', on_delete=models.CASCADE)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
"""
|
"""
|
||||||
|
@ -103,7 +103,7 @@ class CalendarRule(UUIDModel):
|
|||||||
duration = models.IntegerField(default=0) # Duration in minutes
|
duration = models.IntegerField(default=0) # Duration in minutes
|
||||||
duration_unit = models.CharField(choices=dunits, default='MINUTES', max_length=32)
|
duration_unit = models.CharField(choices=dunits, default='MINUTES', max_length=32)
|
||||||
|
|
||||||
calendar = models.ForeignKey(Calendar, related_name='rules')
|
calendar = models.ForeignKey(Calendar, related_name='rules', on_delete=models.CASCADE)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
'''
|
'''
|
||||||
|
@ -59,9 +59,11 @@ class DBFile(UUIDModel):
|
|||||||
try:
|
try:
|
||||||
return encoders.decode(encoders.decode(self.content, 'base64'), 'zip')
|
return encoders.decode(encoders.decode(self.content, 'base64'), 'zip')
|
||||||
except Exception:
|
except Exception:
|
||||||
|
logger.exception('Getting data')
|
||||||
logger.error('DBFile {} has errors and cannot be used'.format(self.name))
|
logger.error('DBFile {} has errors and cannot be used'.format(self.name))
|
||||||
try:
|
try:
|
||||||
self.delete() # Autodelete, invalid...
|
# self.delete() # Autodelete, invalid...
|
||||||
|
pass
|
||||||
except:
|
except:
|
||||||
logger.error('Could not even delete {}!!'.format(self.name))
|
logger.error('Could not even delete {}!!'.format(self.name))
|
||||||
|
|
||||||
@ -69,8 +71,11 @@ class DBFile(UUIDModel):
|
|||||||
|
|
||||||
@data.setter
|
@data.setter
|
||||||
def data(self, value):
|
def data(self, value):
|
||||||
|
logger.debug('Encoding value: {}'.format(value))
|
||||||
self.size = len(value)
|
self.size = len(value)
|
||||||
self.content = encoders.encode(encoders.encode(value, 'zip'), 'base64')
|
content = encoders.encode(encoders.encode(value, 'zip'), 'base64', asText=True)
|
||||||
|
logger.debug('Content is {}'.format(type(content)))
|
||||||
|
self.content = content
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return 'File: {} {} {} {}'.format(self.name, self.size, self.created, self.modified)
|
return 'File: {} {} {} {}'.format(self.name, self.size, self.created, self.modified)
|
||||||
|
@ -64,10 +64,10 @@ class Service(ManagedObjectModel, TaggingMixin):
|
|||||||
or a Terminal Server configuration).
|
or a Terminal Server configuration).
|
||||||
"""
|
"""
|
||||||
# pylint: disable=model-missing-unicode
|
# pylint: disable=model-missing-unicode
|
||||||
provider = models.ForeignKey(Provider, related_name='services')
|
provider = models.ForeignKey(Provider, related_name='services', on_delete=models.CASCADE)
|
||||||
|
|
||||||
# Proxy for this service
|
# Proxy for this service
|
||||||
proxy = models.ForeignKey(Proxy, null=True, blank=True, related_name='services')
|
proxy = models.ForeignKey(Proxy, null=True, blank=True, related_name='services', on_delete=models.CASCADE)
|
||||||
|
|
||||||
|
|
||||||
class Meta(ManagedObjectModel.Meta):
|
class Meta(ManagedObjectModel.Meta):
|
||||||
|
@ -76,8 +76,8 @@ class DeployedService(UUIDModel, TaggingMixin):
|
|||||||
name = models.CharField(max_length=128, default='')
|
name = models.CharField(max_length=128, default='')
|
||||||
short_name = models.CharField(max_length=32, default='')
|
short_name = models.CharField(max_length=32, default='')
|
||||||
comments = models.CharField(max_length=256, default='')
|
comments = models.CharField(max_length=256, default='')
|
||||||
service = models.ForeignKey(Service, null=True, blank=True, related_name='deployedServices')
|
service = models.ForeignKey(Service, null=True, blank=True, related_name='deployedServices', on_delete=models.CASCADE)
|
||||||
osmanager = models.ForeignKey(OSManager, null=True, blank=True, related_name='deployedServices')
|
osmanager = models.ForeignKey(OSManager, null=True, blank=True, related_name='deployedServices', on_delete=models.CASCADE)
|
||||||
transports = models.ManyToManyField(Transport, related_name='deployedServices', db_table='uds__ds_trans')
|
transports = models.ManyToManyField(Transport, related_name='deployedServices', db_table='uds__ds_trans')
|
||||||
assignedGroups = models.ManyToManyField(Group, related_name='deployedServices', db_table='uds__ds_grps')
|
assignedGroups = models.ManyToManyField(Group, related_name='deployedServices', db_table='uds__ds_grps')
|
||||||
state = models.CharField(max_length=1, default=states.servicePool.ACTIVE, db_index=True)
|
state = models.CharField(max_length=1, default=states.servicePool.ACTIVE, db_index=True)
|
||||||
@ -96,7 +96,7 @@ class DeployedService(UUIDModel, TaggingMixin):
|
|||||||
actionsCalendars = models.ManyToManyField(Calendar, related_name='actionsSP', through='CalendarAction')
|
actionsCalendars = models.ManyToManyField(Calendar, related_name='actionsSP', through='CalendarAction')
|
||||||
|
|
||||||
# Usage accounting
|
# Usage accounting
|
||||||
account = models.ForeignKey(Account, null=True, blank=True, related_name='servicesPools')
|
account = models.ForeignKey(Account, null=True, blank=True, related_name='servicesPools', on_delete=models.CASCADE)
|
||||||
|
|
||||||
initial_srvs = models.PositiveIntegerField(default=0)
|
initial_srvs = models.PositiveIntegerField(default=0)
|
||||||
cache_l1_srvs = models.PositiveIntegerField(default=0)
|
cache_l1_srvs = models.PositiveIntegerField(default=0)
|
||||||
|
@ -63,12 +63,13 @@ def country(lang):
|
|||||||
|
|
||||||
|
|
||||||
# Config related
|
# Config related
|
||||||
@register.assignment_tag
|
@register.simple_tag
|
||||||
def get_theme():
|
def get_theme():
|
||||||
return GlobalConfig.UDS_THEME.get()
|
return GlobalConfig.UDS_THEME.get()
|
||||||
|
|
||||||
|
|
||||||
class EnhacedVisual(template.Node):
|
class EnhacedVisual(template.Node):
|
||||||
|
|
||||||
def __init__(self, nodelistTrue, nodelistFalse):
|
def __init__(self, nodelistTrue, nodelistFalse):
|
||||||
self._nodelistTrue = nodelistTrue
|
self._nodelistTrue = nodelistTrue
|
||||||
self._nodelistFalse = nodelistFalse
|
self._nodelistFalse = nodelistFalse
|
||||||
@ -98,6 +99,7 @@ def enhaced_visual(parser, token):
|
|||||||
|
|
||||||
|
|
||||||
class TabIndex(template.Node):
|
class TabIndex(template.Node):
|
||||||
|
|
||||||
def __init__(self, tabIndexName):
|
def __init__(self, tabIndexName):
|
||||||
self.tabIndexIname = tabIndexName
|
self.tabIndexIname = tabIndexName
|
||||||
|
|
||||||
@ -121,6 +123,7 @@ def tabindex(parser, token):
|
|||||||
|
|
||||||
|
|
||||||
class Preference(template.Node):
|
class Preference(template.Node):
|
||||||
|
|
||||||
def __init__(self, modName, prefName):
|
def __init__(self, modName, prefName):
|
||||||
self.modName = modName
|
self.modName = modName
|
||||||
self.prefName = prefName
|
self.prefName = prefName
|
||||||
@ -147,26 +150,27 @@ def preference(parser, token):
|
|||||||
return Preference(modName, prefName)
|
return Preference(modName, prefName)
|
||||||
|
|
||||||
|
|
||||||
@register.assignment_tag
|
@register.simple_tag
|
||||||
def preferences_allowed():
|
def preferences_allowed():
|
||||||
return GlobalConfig.PREFERENCES_ALLOWED.getBool(True)
|
return GlobalConfig.PREFERENCES_ALLOWED.getBool(True)
|
||||||
|
|
||||||
|
|
||||||
@register.assignment_tag
|
@register.simple_tag
|
||||||
def pageReloadTime():
|
def pageReloadTime():
|
||||||
return GlobalConfig.RELOAD_TIME.getInt(True)
|
return GlobalConfig.RELOAD_TIME.getInt(True)
|
||||||
|
|
||||||
|
|
||||||
@register.assignment_tag
|
@register.simple_tag
|
||||||
def root_id():
|
def root_id():
|
||||||
return ROOT_ID
|
return ROOT_ID
|
||||||
|
|
||||||
|
|
||||||
@register.assignment_tag
|
@register.simple_tag
|
||||||
def image_size():
|
def image_size():
|
||||||
return Image.MAX_IMAGE_SIZE
|
return Image.MAX_IMAGE_SIZE
|
||||||
|
|
||||||
@register.assignment_tag
|
|
||||||
|
@register.simple_tag
|
||||||
def calendar_denied_msg():
|
def calendar_denied_msg():
|
||||||
text = GlobalConfig.LIMITED_BY_CALENDAR_TEXT.get().strip()
|
text = GlobalConfig.LIMITED_BY_CALENDAR_TEXT.get().strip()
|
||||||
if text == '':
|
if text == '':
|
||||||
@ -174,8 +178,10 @@ def calendar_denied_msg():
|
|||||||
|
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
# Browser related
|
# Browser related
|
||||||
class IfBrowser(template.Node):
|
class IfBrowser(template.Node):
|
||||||
|
|
||||||
def __init__(self, nodelistTrue, nodelistFalse, browsers):
|
def __init__(self, nodelistTrue, nodelistFalse, browsers):
|
||||||
self._nodelistTrue = nodelistTrue
|
self._nodelistTrue = nodelistTrue
|
||||||
self._nodelistFalse = nodelistFalse
|
self._nodelistFalse = nodelistFalse
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.utils.translation import ugettext_noop as _
|
from django.utils.translation import ugettext_noop as _
|
||||||
from django.core.urlresolvers import reverse
|
from django.urls import reverse
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
|
|
||||||
from uds.core.ui.UserInterface import gui
|
from uds.core.ui.UserInterface import gui
|
||||||
|
@ -30,9 +30,10 @@
|
|||||||
@author: Adolfo Gómez, dkmaster at dkmon dot com
|
@author: Adolfo Gómez, dkmaster at dkmon dot com
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.conf.urls import include, url
|
from django.urls import re_path
|
||||||
|
from django.conf.urls import include
|
||||||
from uds.core.util.modfinder import loadModulesUrls
|
from uds.core.util.modfinder import loadModulesUrls
|
||||||
from django.views.i18n import javascript_catalog
|
from django.views.i18n import JavaScriptCatalog
|
||||||
from uds import REST
|
from uds import REST
|
||||||
import uds.web.views
|
import uds.web.views
|
||||||
|
|
||||||
@ -42,56 +43,56 @@ js_info_dict = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^$', uds.web.views.index, name='uds.web.views.index'),
|
re_path(r'^$', uds.web.views.index, name='uds.web.views.index'),
|
||||||
url(r'^login/$', uds.web.views.login, name='uds.web.views.login'),
|
re_path(r'^login/$', uds.web.views.login, name='uds.web.views.login'),
|
||||||
url(r'^login/(?P<tag>.+)$', uds.web.views.login, name='uds.web.views.login'),
|
re_path(r'^login/(?P<tag>.+)$', uds.web.views.login, name='uds.web.views.login'),
|
||||||
url(r'^logout$', uds.web.views.logout, name='uds.web.views.logout'),
|
re_path(r'^logout$', uds.web.views.logout, name='uds.web.views.logout'),
|
||||||
# Icons
|
# Icons
|
||||||
url(r'^transicon/(?P<idTrans>.+)$', uds.web.views.transportIcon, name='uds.web.views.transportIcon'),
|
re_path(r'^transicon/(?P<idTrans>.+)$', uds.web.views.transportIcon, name='uds.web.views.transportIcon'),
|
||||||
# Images
|
# Images
|
||||||
url(r'^srvimg/(?P<idImage>.+)$', uds.web.views.serviceImage, name='uds.web.views.serviceImage'),
|
re_path(r'^srvimg/(?P<idImage>.+)$', uds.web.views.serviceImage, name='uds.web.views.serviceImage'),
|
||||||
url(r'^galimg/(?P<idImage>.+)$', uds.web.views.image, name='galleryImage'),
|
re_path(r'^galimg/(?P<idImage>.+)$', uds.web.views.image, name='galleryImage'),
|
||||||
# Error URL
|
# Error URL
|
||||||
url(r'^error/(?P<idError>.+)$', uds.web.views.error, name='uds.web.views.error'),
|
re_path(r'^error/(?P<idError>.+)$', uds.web.views.error, name='uds.web.views.error'),
|
||||||
# Transport own link processor
|
# Transport own link processor
|
||||||
url(r'^trans/(?P<idService>.+)/(?P<idTransport>.+)$', uds.web.views.transportOwnLink, name='TransportOwnLink'),
|
re_path(r'^trans/(?P<idService>.+)/(?P<idTransport>.+)$', uds.web.views.transportOwnLink, name='TransportOwnLink'),
|
||||||
# Authenticators custom html
|
# Authenticators custom html
|
||||||
url(r'^customAuth/(?P<idAuth>.*)$', uds.web.views.customAuth, name='uds.web.views.customAuth'),
|
re_path(r'^customAuth/(?P<idAuth>.*)$', uds.web.views.customAuth, name='uds.web.views.customAuth'),
|
||||||
# Preferences
|
# Preferences
|
||||||
url(r'^prefs$', uds.web.views.prefs, name='uds.web.views.prefs'),
|
re_path(r'^prefs$', uds.web.views.prefs, name='uds.web.views.prefs'),
|
||||||
# Change Language
|
# Change Language
|
||||||
url(r'^i18n/', include('django.conf.urls.i18n')),
|
re_path(r'^i18n/', include('django.conf.urls.i18n')),
|
||||||
# Downloads
|
# Downloads
|
||||||
url(r'^idown/(?P<idDownload>[a-zA-Z0-9-]*)$', uds.web.views.download, name='uds.web.views.download'),
|
re_path(r'^idown/(?P<idDownload>[a-zA-Z0-9-]*)$', uds.web.views.download, name='uds.web.views.download'),
|
||||||
# downloads for client
|
# downloads for client
|
||||||
url(r'^down$', uds.web.views.client_downloads, name='uds.web.views.client_downloads'),
|
re_path(r'^down$', uds.web.views.client_downloads, name='uds.web.views.client_downloads'),
|
||||||
url(r'^down/(?P<os>[a-zA-Z0-9-]*)$', uds.web.views.client_downloads, name='uds.web.views.client_downloads'),
|
re_path(r'^down/(?P<os>[a-zA-Z0-9-]*)$', uds.web.views.client_downloads, name='uds.web.views.client_downloads'),
|
||||||
url(r'^pluginDetection/(?P<detection>[a-zA-Z0-9-]*)$', uds.web.views.plugin_detection, name='PluginDetection'),
|
re_path(r'^pluginDetection/(?P<detection>[a-zA-Z0-9-]*)$', uds.web.views.plugin_detection, name='PluginDetection'),
|
||||||
# Client access enabler
|
# Client access enabler
|
||||||
url(r'^enable/(?P<idService>.+)/(?P<idTransport>.+)$', uds.web.views.clientEnabler, name='ClientAccessEnabler'),
|
re_path(r'^enable/(?P<idService>.+)/(?P<idTransport>.+)$', uds.web.views.clientEnabler, name='ClientAccessEnabler'),
|
||||||
|
|
||||||
# Releaser
|
# Releaser
|
||||||
url(r'^release/(?P<idService>.+)$', uds.web.views.release, name='Releaser'),
|
re_path(r'^release/(?P<idService>.+)$', uds.web.views.release, name='Releaser'),
|
||||||
|
|
||||||
# Custom authentication callback
|
# Custom authentication callback
|
||||||
url(r'^auth/(?P<authName>.+)', uds.web.views.authCallback, name='uds.web.views.authCallback'),
|
re_path(r'^auth/(?P<authName>.+)', uds.web.views.authCallback, name='uds.web.views.authCallback'),
|
||||||
url(r'^authinfo/(?P<authName>.+)', uds.web.views.authInfo, name='uds.web.views.authInfo'),
|
re_path(r'^authinfo/(?P<authName>.+)', uds.web.views.authInfo, name='uds.web.views.authInfo'),
|
||||||
url(r'^about', uds.web.views.about, name='uds.web.views.about'),
|
re_path(r'^about', uds.web.views.about, name='uds.web.views.about'),
|
||||||
# Ticket authentication
|
# Ticket authentication
|
||||||
url(r'^tkauth/(?P<ticketId>.+)$', uds.web.views.ticketAuth, name='TicketAuth'),
|
re_path(r'^tkauth/(?P<ticketId>.+)$', uds.web.views.ticketAuth, name='TicketAuth'),
|
||||||
|
|
||||||
# REST Api
|
# REST Api
|
||||||
url(r'^rest/(?P<arguments>.*)$', REST.Dispatcher.as_view(), name="REST"),
|
re_path(r'^rest/(?P<arguments>.*)$', REST.Dispatcher.as_view(), name="REST"),
|
||||||
|
|
||||||
# Web admin GUI
|
# Web admin GUI
|
||||||
url(r'^adm/', include('uds.admin.urls')),
|
re_path(r'^adm/', include('uds.admin.urls')),
|
||||||
|
|
||||||
# Files
|
# Files
|
||||||
url(r'^files/(?P<uuid>.+)', uds.web.views.file_storage, name='uds.web.views.file_storage'),
|
re_path(r'^files/(?P<uuid>.+)', uds.web.views.file_storage, name='uds.web.views.file_storage'),
|
||||||
|
|
||||||
# Internacionalization in javascript
|
# Internacionalization in javascript
|
||||||
# Javascript catalog
|
# Javascript catalog. In fact, lang is not used, but it is maintanied for "backward" user templates compatibility
|
||||||
url(r'^jsi18n/(?P<packages>[a-z]*)$', javascript_catalog, js_info_dict, name='uds.web.views.jsCatalog'),
|
re_path(r'^jsi18n/(?P<lang>[a-z]*)$', JavaScriptCatalog.as_view(), name='uds.web.views.jsCatalog'),
|
||||||
]
|
]
|
||||||
|
|
||||||
# Append urls from special dispatchers
|
# Append urls from special dispatchers
|
||||||
|
@ -37,7 +37,7 @@ from django.shortcuts import render
|
|||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
|
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.core.urlresolvers import reverse
|
from django.urls import reverse
|
||||||
from .transformers import scrambleId, transformId
|
from .transformers import scrambleId, transformId
|
||||||
|
|
||||||
from uds.models import DeployedService, Transport, UserService, Authenticator
|
from uds.models import DeployedService, Transport, UserService, Authenticator
|
||||||
|
@ -32,7 +32,7 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from django.core.urlresolvers import reverse
|
from django.urls import reverse
|
||||||
from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect
|
from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
@ -53,8 +53,7 @@ from uds.models import TicketStore
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
__updated__ = '2018-02-12'
|
||||||
__updated__ = '2017-02-14'
|
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
|
@ -39,10 +39,12 @@ import logging
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
__updated__ = '2016-04-05'
|
__updated__ = '2018-02-12'
|
||||||
|
|
||||||
|
|
||||||
@cache_page(3600, key_prefix='file', cache='memory')
|
@cache_page(3600, key_prefix='file', cache='memory')
|
||||||
def file_storage(request, uuid):
|
def file_storage(request, uuid):
|
||||||
|
logger.debug('Getting {} from DB'.format(uuid))
|
||||||
f = DBFile.objects.get(uuid=uuid)
|
f = DBFile.objects.get(uuid=uuid)
|
||||||
content_type, encoding = mimetypes.guess_type(f.name)
|
content_type, encoding = mimetypes.guess_type(f.name)
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.core.urlresolvers import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import ugettext
|
from django.utils.translation import ugettext
|
||||||
from django.utils import formats
|
from django.utils import formats
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ import logging
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
__updated__ = '2017-11-10'
|
__updated__ = '2018-02-12'
|
||||||
|
|
||||||
|
|
||||||
def about(request):
|
def about(request):
|
||||||
|
@ -32,7 +32,7 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
from django.http import HttpResponse, HttpResponseRedirect
|
from django.http import HttpResponse, HttpResponseRedirect
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.core.urlresolvers import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import ugettext
|
from django.utils.translation import ugettext
|
||||||
|
|
||||||
from uds.core.auths.auth import webLogin, authenticate, authLogLogin, authLogLogout, getUDSCookie, webLoginRequired, webLogout
|
from uds.core.auths.auth import webLogin, authenticate, authLogLogin, authLogLogout, getUDSCookie, webLoginRequired, webLogout
|
||||||
@ -48,7 +48,8 @@ import uds.web.errors as errors
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
__updated__ = '2017-06-01'
|
__updated__ = '2018-02-12'
|
||||||
|
|
||||||
|
|
||||||
# Allow cross-domain login
|
# Allow cross-domain login
|
||||||
# @csrf_exempt
|
# @csrf_exempt
|
||||||
|
Loading…
x
Reference in New Issue
Block a user