mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-05 09:17:54 +03:00
Adapting v2.1
This commit is contained in:
parent
7ab956fa4a
commit
7892a196ac
20
server/src/uds/migrations/0023_transport_allowed_oss.py
Normal file
20
server/src/uds/migrations/0023_transport_allowed_oss.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.9.9 on 2016-10-10 07:51
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('uds', '0022_dbfile_owner'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='transport',
|
||||||
|
name='allowed_oss',
|
||||||
|
field=models.CharField(default='', max_length=255),
|
||||||
|
),
|
||||||
|
]
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
__updated__ = '2016-02-26'
|
__updated__ = '2016-08-24'
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import signals
|
from django.db.models import signals
|
||||||
@ -59,6 +59,9 @@ class Transport(ManagedObjectModel, TaggingMixin):
|
|||||||
# pylint: disable=model-missing-unicode
|
# pylint: disable=model-missing-unicode
|
||||||
priority = models.IntegerField(default=0, db_index=True)
|
priority = models.IntegerField(default=0, db_index=True)
|
||||||
nets_positive = models.BooleanField(default=False)
|
nets_positive = models.BooleanField(default=False)
|
||||||
|
# We store allowed oss as a comma-separated list
|
||||||
|
allowed_oss = models.CharField(max_length=255, default='')
|
||||||
|
|
||||||
|
|
||||||
class Meta(ManagedObjectModel.Meta):
|
class Meta(ManagedObjectModel.Meta):
|
||||||
'''
|
'''
|
||||||
@ -113,6 +116,12 @@ class Transport(ManagedObjectModel, TaggingMixin):
|
|||||||
else:
|
else:
|
||||||
return self.networks.filter(net_start__lte=ip, net_end__gte=ip).count() == 0
|
return self.networks.filter(net_start__lte=ip, net_end__gte=ip).count() == 0
|
||||||
|
|
||||||
|
def validForOs(self, os):
|
||||||
|
logger.debug('Checkin if os "{}" is in "{}"'.format(os, self.allowed_oss))
|
||||||
|
if self.allowed_oss == '' or os in self.allowed_oss.split(','):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return u"{0} of type {1} (id:{2})".format(self.name, self.data_type, self.id)
|
return u"{0} of type {1} (id:{2})".format(self.name, self.data_type, self.id)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user