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

Adapting v2.1

This commit is contained in:
Adolfo Gómez García 2016-10-10 07:52:03 +02:00
parent 7ab956fa4a
commit 7892a196ac
3 changed files with 31 additions and 2 deletions

View File

@ -1 +1 @@
2.0.0
2.1.0

View 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),
),
]

View File

@ -33,7 +33,7 @@
from __future__ import unicode_literals
__updated__ = '2016-02-26'
__updated__ = '2016-08-24'
from django.db import models
from django.db.models import signals
@ -59,6 +59,9 @@ class Transport(ManagedObjectModel, TaggingMixin):
# pylint: disable=model-missing-unicode
priority = models.IntegerField(default=0, db_index=True)
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):
'''
@ -113,6 +116,12 @@ class Transport(ManagedObjectModel, TaggingMixin):
else:
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):
return u"{0} of type {1} (id:{2})".format(self.name, self.data_type, self.id)