forked from shaba/openuds
* More default unicode literals
* Added support for new network input methods * Fixed ip auth to support network input methods * Added support for new network input & modification to transport networks * Fixed some anoying warnings :-) * Upgraded required administration client version to 1.2 *
This commit is contained in:
parent
7bc1207a6c
commit
5538caa9bb
@ -126,6 +126,7 @@ encoding//src/uds/migrations/0010_auto__add_field_log_owner_type.py=utf-8
|
||||
encoding//src/uds/migrations/0011_auto__add_statscounters__add_statsevents__chg_field_log_created__chg_f.py=utf-8
|
||||
encoding//src/uds/migrations/0012_auto__add_field_authenticator_small_name.py=utf-8
|
||||
encoding//src/uds/migrations/0013_auto__add_field_group_is_meta__add_field_uniqueid_stamp.py=utf-8
|
||||
encoding//src/uds/migrations/0014_auto__add_field_network_net_string.py=utf-8
|
||||
encoding//src/uds/models.py=utf-8
|
||||
encoding//src/uds/osmanagers/LinuxOsManager/LinuxOsManager.py=utf-8
|
||||
encoding//src/uds/osmanagers/LinuxOsManager/__init__.py=utf-8
|
||||
|
@ -2,6 +2,7 @@
|
||||
'''
|
||||
Settings file for uds server (Django)
|
||||
'''
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
import django
|
||||
|
@ -32,11 +32,12 @@
|
||||
|
||||
@author: Adolfo Gómez, dkmaster at dkmon dot com
|
||||
'''
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_noop as _
|
||||
from uds.core.auths import Authenticator
|
||||
from uds.core.auths.GroupsManager import GroupsManager
|
||||
from uds.core.util import net
|
||||
from uds.core.util.Config import Config
|
||||
import logging, random, string
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -52,35 +53,22 @@ class IPAuth(Authenticator):
|
||||
groupNameLabel = _('IP Range')
|
||||
isExternalSource = True
|
||||
|
||||
def __init__(self, dbAuth, environment, values = None):
|
||||
super(IPAuth, self).__init__(dbAuth, environment, values)
|
||||
# Ignore values
|
||||
|
||||
def valuesDict(self):
|
||||
res = {}
|
||||
return res
|
||||
|
||||
def __str__(self):
|
||||
def initialize(self, values):
|
||||
pass
|
||||
|
||||
def __unicode__(self):
|
||||
return "IP Authenticator"
|
||||
|
||||
def marshal(self):
|
||||
return "v1"
|
||||
|
||||
def unmarshal(self, str_):
|
||||
data = str_.split('\t')
|
||||
if data[0] == 'v1':
|
||||
pass
|
||||
|
||||
def getGroups(self, ip, groupsManager):
|
||||
# these groups are a bit special. They are in fact ip-ranges, and we must check that the ip is in betwen
|
||||
# The ranges are stored in group names
|
||||
ip = net.ipToLong(ip)
|
||||
for g in groupsManager.getGroupsNames():
|
||||
rangeStart, rangeEnd = g.split('-')
|
||||
rangeStart = net.ipToLong(rangeStart)
|
||||
rangeEnd = net.ipToLong(rangeEnd)
|
||||
if ip >= rangeStart and ip <= rangeEnd:
|
||||
groupsManager.validate(g)
|
||||
try:
|
||||
if net.ipInNetwork(ip, g):
|
||||
groupsManager.validate(g)
|
||||
except Exception as e:
|
||||
logger.error('Invalid network for IP auth: {0}'.format(unicode(e)))
|
||||
|
||||
def authenticate(self, username, credentials, groupsManager):
|
||||
# If credentials is a dict, that can't be sent directly from web interface, we allow entering
|
||||
|
@ -25,15 +25,17 @@
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
from uds.models import NEVER
|
||||
|
||||
|
||||
'''
|
||||
@author: Adolfo Gómez, dkmaster at dkmon dot com
|
||||
'''
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from uds.models import NEVER
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from uds.core.managers import statsManager
|
||||
import datetime
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -0,0 +1,243 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
# Adding field 'Network.net_string'
|
||||
db.add_column(u'uds_network', 'net_string',
|
||||
self.gf('django.db.models.fields.CharField')(default=u'', max_length=128),
|
||||
keep_default=False)
|
||||
|
||||
if not db.dry_run:
|
||||
from uds.core.util import net
|
||||
for o in orm.Network.objects.all():
|
||||
o.net_string = net.longToIp(o.net_start) + '-' + net.longToIp(o.net_end)
|
||||
o.save()
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting field 'Network.net_string'
|
||||
db.delete_column(u'uds_network', 'net_string')
|
||||
|
||||
|
||||
models = {
|
||||
u'uds.authenticator': {
|
||||
'Meta': {'ordering': "(u'name',)", 'object_name': 'Authenticator'},
|
||||
'comments': ('django.db.models.fields.TextField', [], {'default': "u''"}),
|
||||
'data': ('django.db.models.fields.TextField', [], {'default': "u''"}),
|
||||
'data_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
|
||||
'priority': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'}),
|
||||
'small_name': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '32', 'db_index': 'True'})
|
||||
},
|
||||
u'uds.cache': {
|
||||
'Meta': {'object_name': 'Cache', 'db_table': "u'uds_utility_cache'"},
|
||||
'created': ('django.db.models.fields.DateTimeField', [], {}),
|
||||
'key': ('django.db.models.fields.CharField', [], {'max_length': '64', 'primary_key': 'True'}),
|
||||
'owner': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
|
||||
'validity': ('django.db.models.fields.IntegerField', [], {'default': '60'}),
|
||||
'value': ('django.db.models.fields.TextField', [], {'default': "u''"})
|
||||
},
|
||||
u'uds.config': {
|
||||
'Meta': {'unique_together': "((u'section', u'key'),)", 'object_name': 'Config', 'db_table': "u'uds_configuration'"},
|
||||
'crypt': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'key': ('django.db.models.fields.CharField', [], {'max_length': '64', 'db_index': 'True'}),
|
||||
'long': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'section': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
|
||||
'value': ('django.db.models.fields.TextField', [], {'default': "u''"})
|
||||
},
|
||||
u'uds.delayedtask': {
|
||||
'Meta': {'object_name': 'DelayedTask'},
|
||||
'execution_delay': ('django.db.models.fields.PositiveIntegerField', [], {}),
|
||||
'execution_time': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'insert_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'instance': ('django.db.models.fields.TextField', [], {}),
|
||||
'tag': ('django.db.models.fields.CharField', [], {'max_length': '64', 'db_index': 'True'}),
|
||||
'type': ('django.db.models.fields.CharField', [], {'max_length': '128'})
|
||||
},
|
||||
u'uds.deployedservice': {
|
||||
'Meta': {'object_name': 'DeployedService', 'db_table': "u'uds__deployed_service'"},
|
||||
'assignedGroups': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "u'deployedServices'", 'symmetrical': 'False', 'db_table': "u'uds__ds_grps'", 'to': u"orm['uds.Group']"}),
|
||||
'cache_l1_srvs': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
|
||||
'cache_l2_srvs': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
|
||||
'comments': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '256'}),
|
||||
'current_pub_revision': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'initial_srvs': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
|
||||
'max_srvs': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '128'}),
|
||||
'osmanager': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'deployedServices'", 'null': 'True', 'to': u"orm['uds.OSManager']"}),
|
||||
'service': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'deployedServices'", 'null': 'True', 'to': u"orm['uds.Service']"}),
|
||||
'state': ('django.db.models.fields.CharField', [], {'default': "'A'", 'max_length': '1', 'db_index': 'True'}),
|
||||
'state_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1972, 7, 1, 0, 0)'}),
|
||||
'transports': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "u'deployedServices'", 'symmetrical': 'False', 'db_table': "u'uds__ds_trans'", 'to': u"orm['uds.Transport']"})
|
||||
},
|
||||
u'uds.deployedservicepublication': {
|
||||
'Meta': {'ordering': "(u'publish_date',)", 'object_name': 'DeployedServicePublication', 'db_table': "u'uds__deployed_service_pub'"},
|
||||
'data': ('django.db.models.fields.TextField', [], {'default': "u''"}),
|
||||
'deployed_service': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'publications'", 'to': u"orm['uds.DeployedService']"}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'publish_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
|
||||
'revision': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
|
||||
'state': ('django.db.models.fields.CharField', [], {'default': "'P'", 'max_length': '1', 'db_index': 'True'}),
|
||||
'state_date': ('django.db.models.fields.DateTimeField', [], {})
|
||||
},
|
||||
u'uds.group': {
|
||||
'Meta': {'ordering': "(u'name',)", 'unique_together': "((u'manager', u'name'),)", 'object_name': 'Group'},
|
||||
'comments': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '256'}),
|
||||
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['uds.Group']", 'symmetrical': 'False'}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'is_meta': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
|
||||
'manager': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'groups'", 'to': u"orm['uds.Authenticator']"}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
|
||||
'state': ('django.db.models.fields.CharField', [], {'default': "'A'", 'max_length': '1', 'db_index': 'True'}),
|
||||
'users': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "u'groups'", 'symmetrical': 'False', 'to': u"orm['uds.User']"})
|
||||
},
|
||||
u'uds.log': {
|
||||
'Meta': {'object_name': 'Log'},
|
||||
'created': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
|
||||
'data': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255'}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'level': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '0', 'db_index': 'True'}),
|
||||
'owner_id': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'}),
|
||||
'owner_type': ('django.db.models.fields.SmallIntegerField', [], {'default': '0', 'db_index': 'True'}),
|
||||
'source': ('django.db.models.fields.CharField', [], {'default': "u'internal'", 'max_length': '16', 'db_index': 'True'})
|
||||
},
|
||||
u'uds.network': {
|
||||
'Meta': {'object_name': 'Network'},
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64'}),
|
||||
'net_end': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
|
||||
'net_start': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
|
||||
'net_string': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '128'}),
|
||||
'transports': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "u'networks'", 'symmetrical': 'False', 'db_table': "u'uds_net_trans'", 'to': u"orm['uds.Transport']"})
|
||||
},
|
||||
u'uds.osmanager': {
|
||||
'Meta': {'ordering': "(u'name',)", 'object_name': 'OSManager'},
|
||||
'comments': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
|
||||
'data': ('django.db.models.fields.TextField', [], {'default': "u''"}),
|
||||
'data_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'})
|
||||
},
|
||||
u'uds.provider': {
|
||||
'Meta': {'ordering': "(u'name',)", 'object_name': 'Provider'},
|
||||
'comments': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
|
||||
'data': ('django.db.models.fields.TextField', [], {'default': "u''"}),
|
||||
'data_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'})
|
||||
},
|
||||
u'uds.scheduler': {
|
||||
'Meta': {'object_name': 'Scheduler'},
|
||||
'frecuency': ('django.db.models.fields.PositiveIntegerField', [], {'default': '86400'}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'last_execution': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64'}),
|
||||
'next_execution': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1972, 7, 1, 0, 0)', 'db_index': 'True'}),
|
||||
'owner_server': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '64', 'db_index': 'True'}),
|
||||
'state': ('django.db.models.fields.CharField', [], {'default': "'X'", 'max_length': '1', 'db_index': 'True'})
|
||||
},
|
||||
u'uds.service': {
|
||||
'Meta': {'ordering': "(u'name',)", 'unique_together': "((u'provider', u'name'),)", 'object_name': 'Service'},
|
||||
'comments': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
|
||||
'data': ('django.db.models.fields.TextField', [], {'default': "u''"}),
|
||||
'data_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
'provider': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'services'", 'to': u"orm['uds.Provider']"})
|
||||
},
|
||||
u'uds.statscounters': {
|
||||
'Meta': {'object_name': 'StatsCounters', 'db_table': "u'uds_stats_c'"},
|
||||
'counter_type': ('django.db.models.fields.SmallIntegerField', [], {'default': '0', 'db_index': 'True'}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'owner_id': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'}),
|
||||
'owner_type': ('django.db.models.fields.SmallIntegerField', [], {'default': '0', 'db_index': 'True'}),
|
||||
'stamp': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'}),
|
||||
'value': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'})
|
||||
},
|
||||
u'uds.statsevents': {
|
||||
'Meta': {'object_name': 'StatsEvents', 'db_table': "u'uds_stats_e'"},
|
||||
'event_type': ('django.db.models.fields.SmallIntegerField', [], {'default': '0', 'db_index': 'True'}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'owner_id': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'}),
|
||||
'owner_type': ('django.db.models.fields.SmallIntegerField', [], {'default': '0', 'db_index': 'True'}),
|
||||
'stamp': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'})
|
||||
},
|
||||
u'uds.storage': {
|
||||
'Meta': {'object_name': 'Storage'},
|
||||
'attr1': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '64', 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
|
||||
'data': ('django.db.models.fields.TextField', [], {'default': "u''"}),
|
||||
'key': ('django.db.models.fields.CharField', [], {'max_length': '64', 'primary_key': 'True'}),
|
||||
'owner': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'})
|
||||
},
|
||||
u'uds.transport': {
|
||||
'Meta': {'ordering': "(u'name',)", 'object_name': 'Transport'},
|
||||
'comments': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
|
||||
'data': ('django.db.models.fields.TextField', [], {'default': "u''"}),
|
||||
'data_type': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
|
||||
'nets_positive': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'priority': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'})
|
||||
},
|
||||
u'uds.uniqueid': {
|
||||
'Meta': {'ordering': "(u'-seq',)", 'unique_together': "((u'basename', u'seq'),)", 'object_name': 'UniqueId'},
|
||||
'assigned': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}),
|
||||
'basename': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'owner': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '128', 'db_index': 'True'}),
|
||||
'seq': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
|
||||
'stamp': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'})
|
||||
},
|
||||
u'uds.user': {
|
||||
'Meta': {'ordering': "(u'name',)", 'unique_together': "((u'manager', u'name'),)", 'object_name': 'User'},
|
||||
'comments': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'is_admin': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'last_access': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1972, 7, 1, 0, 0)'}),
|
||||
'manager': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'users'", 'to': u"orm['uds.Authenticator']"}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
|
||||
'password': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '128'}),
|
||||
'real_name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
'staff_member': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'state': ('django.db.models.fields.CharField', [], {'max_length': '1', 'db_index': 'True'})
|
||||
},
|
||||
u'uds.userpreference': {
|
||||
'Meta': {'object_name': 'UserPreference'},
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'module': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}),
|
||||
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'preferences'", 'to': u"orm['uds.User']"}),
|
||||
'value': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'})
|
||||
},
|
||||
u'uds.userservice': {
|
||||
'Meta': {'ordering': "(u'creation_date',)", 'object_name': 'UserService', 'db_table': "u'uds__user_service'"},
|
||||
'cache_level': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '0', 'db_index': 'True'}),
|
||||
'creation_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
|
||||
'data': ('django.db.models.fields.TextField', [], {'default': "u''"}),
|
||||
'deployed_service': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'userServices'", 'to': u"orm['uds.DeployedService']"}),
|
||||
'friendly_name': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '128'}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'in_use': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'in_use_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1972, 7, 1, 0, 0)'}),
|
||||
'os_state': ('django.db.models.fields.CharField', [], {'default': "'P'", 'max_length': '1'}),
|
||||
'publication': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'userServices'", 'null': 'True', 'to': u"orm['uds.DeployedServicePublication']"}),
|
||||
'src_hostname': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '64'}),
|
||||
'src_ip': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '15'}),
|
||||
'state': ('django.db.models.fields.CharField', [], {'default': "'P'", 'max_length': '1', 'db_index': 'True'}),
|
||||
'state_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
|
||||
'unique_id': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '128', 'db_index': 'True'}),
|
||||
'user': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "u'userServices'", 'null': 'True', 'blank': 'True', 'to': u"orm['uds.User']"})
|
||||
}
|
||||
}
|
||||
|
||||
complete_apps = ['uds']
|
@ -1970,6 +1970,7 @@ class Network(models.Model):
|
||||
name = models.CharField(max_length = 64, unique = True)
|
||||
net_start = models.BigIntegerField(db_index = True)
|
||||
net_end = models.BigIntegerField(db_index = True)
|
||||
net_string = models.CharField(max_length = 128, default = '')
|
||||
transports = models.ManyToManyField(Transport, related_name='networks', db_table='uds_net_trans')
|
||||
|
||||
@staticmethod
|
||||
@ -1981,7 +1982,7 @@ class Network(models.Model):
|
||||
return Network.objects.filter(net_start__lte=ip, net_end__gte=ip)
|
||||
|
||||
@staticmethod
|
||||
def create(name, netStart, netEnd):
|
||||
def create(name, netRange):
|
||||
'''
|
||||
Creates an network record, with the specified net start and net end (dotted quad)
|
||||
|
||||
@ -1990,7 +1991,8 @@ class Network(models.Model):
|
||||
|
||||
netEnd: Network end
|
||||
'''
|
||||
return Network.objects.create(name=name, net_start = net.ipToLong(netStart), net_end = Network.ipToLong(netEnd))
|
||||
nr = net.networksFromString(netRange, False)
|
||||
return Network.objects.create(name=name, net_start = nr[0], net_end = nr[1], net_string = netRange)
|
||||
|
||||
@property
|
||||
def netStart(self):
|
||||
@ -2012,7 +2014,7 @@ class Network(models.Model):
|
||||
'''
|
||||
return net.longToIp(self.net_end)
|
||||
|
||||
def update(self, name, netStart, netEnd):
|
||||
def update(self, name, netRange):
|
||||
'''
|
||||
Updated this network with provided values
|
||||
|
||||
@ -2024,10 +2026,12 @@ class Network(models.Model):
|
||||
netEnd: new Network end (quad dotted)
|
||||
'''
|
||||
self.name = name
|
||||
self.net_start = net.ipToLong(netStart)
|
||||
self.net_end = net.ipToLong(netEnd)
|
||||
nr = net.networksFromString(netRange, False)
|
||||
self.net_start = nr[0]
|
||||
self.net_end = nr[1]
|
||||
self.net_string = netRange
|
||||
self.save()
|
||||
|
||||
def __unicode__(self):
|
||||
return u'Network {0} from {1} to {2}'.format(self.name, net.longToIp(self.net_start), net.longToIp(self.net_end))
|
||||
return u'Network {0} ({1}) from {2} to {3}'.format(self.name, self.net_string, net.longToIp(self.net_start), net.longToIp(self.net_end))
|
||||
|
||||
|
@ -61,8 +61,8 @@ class PhysicalMachinesProvider(services.ServiceProvider):
|
||||
'''
|
||||
return str.join( '\t', [ 'v1' ] )
|
||||
|
||||
def unmarshal(self, str):
|
||||
data = str.split('\t')
|
||||
def unmarshal(self, str_):
|
||||
data = str_.split('\t')
|
||||
if data[0] == 'v1':
|
||||
pass
|
||||
|
||||
|
@ -46,7 +46,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
ADMIN_AUTH = '#'
|
||||
|
||||
CLIENT_VERSION_REQUIRED = '1.1.1'
|
||||
CLIENT_VERSION_REQUIRED = '1.2.0'
|
||||
|
||||
class Credentials(object):
|
||||
'''
|
||||
|
@ -30,6 +30,7 @@
|
||||
'''
|
||||
@author: Adolfo Gómez, dkmaster at dkmon dot com
|
||||
'''
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.db import IntegrityError
|
||||
|
@ -30,29 +30,28 @@
|
||||
'''
|
||||
@author: Adolfo Gómez, dkmaster at dkmon dot com
|
||||
'''
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import IntegrityError
|
||||
from uds.models import User as DbUser, Group as DbGroup, Authenticator as DbAuthenticator, State
|
||||
from uds.models import User as DbUser, Group as DbGroup, Authenticator as DbAuthenticator
|
||||
from uds.core.managers.CryptoManager import CryptoManager
|
||||
from ..util.Exceptions import DuplicateEntryException, InsertException, ParametersException
|
||||
from uds.core.auths.Exceptions import AuthenticatorException, InvalidUserException
|
||||
from uds.xmlrpc.util.Exceptions import DuplicateEntryException, InsertException, ParametersException, FindException
|
||||
from AdminAuth import needs_credentials
|
||||
from Groups import dictFromGroup
|
||||
from uds.core.auths.User import User
|
||||
import hashlib
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
INVALID_PASS = '@#&&/%&$%&/adffa'
|
||||
|
||||
def dictFromUser(usr, groups = None):
|
||||
dict = { 'idParent' : str(usr.manager.id), 'nameParent' : usr.manager.name, 'id' : str(usr.id), 'name' : usr.name, 'realName' : usr.real_name,
|
||||
dct = { 'idParent' : str(usr.manager.id), 'nameParent' : usr.manager.name, 'id' : str(usr.id), 'name' : usr.name, 'realName' : usr.real_name,
|
||||
'comments' : usr.comments, 'state' : usr.state, 'lastAccess' : usr.last_access, 'password' : INVALID_PASS, 'oldPassword' : INVALID_PASS,
|
||||
'staffMember' : usr.staff_member, 'isAdmin' : usr.is_admin }
|
||||
if groups != None:
|
||||
dict['groups'] = groups
|
||||
logger.debug('Dict: {0}'.format(dict))
|
||||
return dict
|
||||
dct['groups'] = groups
|
||||
logger.debug('Dict: {0}'.format(dct))
|
||||
return dct
|
||||
|
||||
@needs_credentials
|
||||
def getUsers(credentials, idParent):
|
||||
@ -69,11 +68,11 @@ def getUsers(credentials, idParent):
|
||||
return res
|
||||
|
||||
@needs_credentials
|
||||
def getUser(credentials, id):
|
||||
def getUser(credentials, id_):
|
||||
'''
|
||||
'''
|
||||
try:
|
||||
usr = User(DbUser.objects.get(pk=id))
|
||||
usr = User(DbUser.objects.get(pk=id_))
|
||||
grps = []
|
||||
for g in usr.groups():
|
||||
logger.debug(g)
|
||||
@ -167,17 +166,21 @@ def removeUsers(credentials, ids):
|
||||
return True
|
||||
|
||||
@needs_credentials
|
||||
def getUserGroups(credentials, id):
|
||||
def getUserGroups(credentials, id_):
|
||||
'''
|
||||
Get groups assigned to this user
|
||||
'''
|
||||
user = DbUser.objects.get(pk=id)
|
||||
auth = user.manager.getInstance()
|
||||
res = []
|
||||
#if auth.isExternalSource == False:
|
||||
for grp in user.getGroups():
|
||||
res.append(dictFromGroup(grp))
|
||||
return res
|
||||
try:
|
||||
user = DbUser.objects.get(pk=id_)
|
||||
#auth = user.manager.getInstance()
|
||||
res = []
|
||||
#if auth.isExternalSource == False:
|
||||
for grp in user.getGroups():
|
||||
res.append(dictFromGroup(grp))
|
||||
return res
|
||||
except Exception as e:
|
||||
logger.exception(e)
|
||||
raise FindException(str(e))
|
||||
|
||||
@needs_credentials
|
||||
def changeUsersState(credentials, ids, newState):
|
||||
|
@ -50,8 +50,8 @@ def getServiceProvidersTypes(credentials):
|
||||
Returns the types of services providers registered in system
|
||||
'''
|
||||
res = []
|
||||
for type in ServiceProviderFactory.factory().providers().values():
|
||||
val = { 'name' : _(type.name()), 'type' : type.type(), 'description' : _(type.description()), 'icon' : type.icon() }
|
||||
for type_ in ServiceProviderFactory.factory().providers().values():
|
||||
val = { 'name' : _(type_.name()), 'type' : type_.type(), 'description' : _(type_.description()), 'icon' : type_.icon() }
|
||||
res.append(val)
|
||||
return res
|
||||
|
||||
@ -70,19 +70,19 @@ def getServiceProviders(credentials):
|
||||
return res
|
||||
|
||||
@needs_credentials
|
||||
def getServiceProviderGui(credentials, type):
|
||||
def getServiceProviderGui(credentials, type_):
|
||||
'''
|
||||
Returns the description of an gui for the specified service provider
|
||||
'''
|
||||
spType = ServiceProviderFactory.factory().lookup(type)
|
||||
spType = ServiceProviderFactory.factory().lookup(type_)
|
||||
return spType.guiDescription()
|
||||
|
||||
@needs_credentials
|
||||
def getServiceProvider(credentials, id):
|
||||
def getServiceProvider(credentials, id_):
|
||||
'''
|
||||
Returns the specified service provider (at database)
|
||||
'''
|
||||
data = Provider.objects.get(pk=id)
|
||||
data = Provider.objects.get(pk=id_)
|
||||
res = [
|
||||
{ 'name' : 'name', 'value' : data.name },
|
||||
{ 'name' : 'comments', 'value' : data.comments },
|
||||
@ -96,7 +96,7 @@ def getServiceProvider(credentials, id):
|
||||
return res
|
||||
|
||||
@needs_credentials
|
||||
def createServiceProvider(credentials, type, data):
|
||||
def createServiceProvider(credentials, type_, data):
|
||||
'''
|
||||
Creates a new service provider with specified type and data
|
||||
It's mandatory that data contains at least 'name' and 'comments'.
|
||||
@ -105,7 +105,7 @@ def createServiceProvider(credentials, type, data):
|
||||
try:
|
||||
dic = dictFromData(data)
|
||||
# First create data without serialization, then serialies data with correct environment
|
||||
sp = Provider.objects.create(name = dic['name'], comments = dic['comments'], data_type = type)
|
||||
sp = Provider.objects.create(name = dic['name'], comments = dic['comments'], data_type = type_)
|
||||
sp.data = sp.getInstance(dic).serialize()
|
||||
sp.save()
|
||||
except services.ServiceProvider.ValidationException as e:
|
||||
@ -119,14 +119,14 @@ def createServiceProvider(credentials, type, data):
|
||||
return True
|
||||
|
||||
@needs_credentials
|
||||
def modifyServiceProvider(credentials, id, data):
|
||||
def modifyServiceProvider(credentials, id_, data):
|
||||
'''
|
||||
Modifies an existing service provider with specified id and data
|
||||
It's mandatory that data contains at least 'name' and 'comments'.
|
||||
The expected structure is the same that provided at getServiceProvider
|
||||
'''
|
||||
try:
|
||||
prov = Provider.objects.get(pk=id)
|
||||
prov = Provider.objects.get(pk=id_)
|
||||
dic = dictFromData(data)
|
||||
sp = prov.getInstance(dic)
|
||||
prov.data = sp.serialize()
|
||||
@ -144,12 +144,12 @@ def modifyServiceProvider(credentials, id, data):
|
||||
return True
|
||||
|
||||
@needs_credentials
|
||||
def removeServiceProvider(credentials, id):
|
||||
def removeServiceProvider(credentials, id_):
|
||||
'''
|
||||
Removes from database provider with specified id
|
||||
'''
|
||||
try:
|
||||
prov = Provider.objects.get(pk=id)
|
||||
prov = Provider.objects.get(pk=id_)
|
||||
if prov.services.count() > 0:
|
||||
raise DeleteException(_('Can\'t delete service provider with services associated'))
|
||||
prov.delete()
|
||||
@ -158,35 +158,35 @@ def removeServiceProvider(credentials, id):
|
||||
return True
|
||||
|
||||
@needs_credentials
|
||||
def getOffersFromServiceProvider(credentials, type):
|
||||
def getOffersFromServiceProvider(credentials, type_):
|
||||
'''
|
||||
Returns the services offered from the provider
|
||||
'''
|
||||
spType = ServiceProviderFactory.factory().lookup(type)
|
||||
spType = ServiceProviderFactory.factory().lookup(type_)
|
||||
res = []
|
||||
for type in spType.getServicesTypes():
|
||||
val = { 'name' : _(type.name()), 'type' : type.type(), 'description' : _(type.description()), 'icon' : type.icon() }
|
||||
for t in spType.getServicesTypes():
|
||||
val = { 'name' : _(t.name()), 'type' : t.type(), 'description' : _(t.description()), 'icon' : t.icon() }
|
||||
res.append(val)
|
||||
return res
|
||||
|
||||
@needs_credentials
|
||||
def testServiceProvider(credentials, type, data):
|
||||
def testServiceProvider(credentials, type_, data):
|
||||
'''
|
||||
invokes the test function of the specified service provider type, with the suplied data
|
||||
'''
|
||||
logger.debug("Testing service provider, type: {0}, data:{1}".format(type, data))
|
||||
spType = ServiceProviderFactory.factory().lookup(type)
|
||||
spType = ServiceProviderFactory.factory().lookup(type_)
|
||||
# We need an "temporary" environment to test this service
|
||||
dict = dictFromData(data)
|
||||
res = spType.test(Environment.getTempEnv(), dict)
|
||||
dct = dictFromData(data)
|
||||
res = spType.test(Environment.getTempEnv(), dct)
|
||||
return {'ok' : res[0], 'message' : res[1]}
|
||||
|
||||
@needs_credentials
|
||||
def checkServiceProvider(credentials, id):
|
||||
def checkServiceProvider(credentials, id_):
|
||||
'''
|
||||
Invokes the check function of the specified service provider
|
||||
'''
|
||||
prov = Provider.objects.get(id=id)
|
||||
prov = Provider.objects.get(id=id_)
|
||||
sp = prov.getInstance()
|
||||
return sp.check()
|
||||
|
||||
|
@ -30,18 +30,19 @@
|
||||
'''
|
||||
@author: Adolfo Gómez, dkmaster at dkmon dot com
|
||||
'''
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.db import IntegrityError
|
||||
from uds.models import Network, Transport
|
||||
from ..util.Exceptions import InsertException, FindException, DeleteException
|
||||
from ..auths.AdminAuth import needs_credentials
|
||||
from uds.xmlrpc.util.Exceptions import InsertException, FindException, DeleteException
|
||||
from uds.xmlrpc.auths.AdminAuth import needs_credentials
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
def dictFromNetwork(net):
|
||||
return { 'id' : str(net.id), 'name' : net.name, 'netStart' : net.netStart, 'netEnd' : net.netEnd }
|
||||
return { 'id' : str(net.id), 'name' : net.name, 'netRange' : net.net_string }
|
||||
|
||||
@needs_credentials
|
||||
def getNetworks(credentials):
|
||||
@ -54,26 +55,26 @@ def getNetworks(credentials):
|
||||
return res
|
||||
|
||||
@needs_credentials
|
||||
def getNetworksForTransport(credentials, id):
|
||||
def getNetworksForTransport(credentials, id_):
|
||||
try:
|
||||
res = [ str(n.id) for n in Transport.objects.get(pk=id).networks.all().order_by('name') ]
|
||||
res = [ str(n.id) for n in Transport.objects.get(pk=id_).networks.all().order_by('name') ]
|
||||
except Exception:
|
||||
res = []
|
||||
return res
|
||||
|
||||
@needs_credentials
|
||||
def setNetworksForTransport(credentials, id, networks):
|
||||
def setNetworksForTransport(credentials, id_, networks):
|
||||
try:
|
||||
trans = Transport.objects.get(pk=id)
|
||||
trans = Transport.objects.get(pk=id_)
|
||||
trans.networks = Network.objects.filter(id__in=networks)
|
||||
except Transport.DoesNotExist:
|
||||
raise FindException(_('Can\'t locate the transport') + '.' + _('Please, refresh interface'))
|
||||
return True
|
||||
|
||||
@needs_credentials
|
||||
def getNetwork(credentials, id):
|
||||
def getNetwork(credentials, id_):
|
||||
try:
|
||||
net = Network.objects.get(pk=id)
|
||||
net = Network.objects.get(pk=id_)
|
||||
except Network.DoesNotExist:
|
||||
raise FindException(_('Can\'t locate the network') + '.' + _('Please, refresh interface'))
|
||||
return dictFromNetwork(net)
|
||||
@ -81,7 +82,7 @@ def getNetwork(credentials, id):
|
||||
@needs_credentials
|
||||
def createNetwork(credentials, network):
|
||||
try:
|
||||
net = Network.create(network['name'], network['netStart'], network['netEnd'])
|
||||
Network.create(network['name'], network['netRange'])
|
||||
except IntegrityError:
|
||||
raise InsertException(_('Name %s already exists') % (network['name']))
|
||||
return True
|
||||
@ -90,7 +91,7 @@ def createNetwork(credentials, network):
|
||||
def modifyNetwork(credentials, network):
|
||||
try:
|
||||
net = Network.objects.get(pk=network['id'])
|
||||
net.update(network['name'], network['netStart'], network['netEnd'])
|
||||
net.update(network['name'], network['netRange'])
|
||||
except Network.DoesNotExist:
|
||||
raise FindException(_('Can\'t locate the network') + '.' + _('Please, refresh interface'))
|
||||
except IntegrityError:
|
||||
@ -99,7 +100,10 @@ def modifyNetwork(credentials, network):
|
||||
|
||||
@needs_credentials
|
||||
def removeNetworks(credentials, ids):
|
||||
Network.objects.filter(id__in=ids).delete()
|
||||
try:
|
||||
Network.objects.filter(id__in=ids).delete()
|
||||
except Exception as e:
|
||||
raise DeleteException(unicode(e))
|
||||
return True
|
||||
|
||||
def registerNetworksFunctions(dispatcher):
|
||||
|
@ -31,14 +31,11 @@
|
||||
@author: Adolfo Gómez, dkmaster at dkmon dot com
|
||||
'''
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
from uds.models import Transport, DeployedService
|
||||
from uds.models import Transport
|
||||
from uds.core.transports.TransportsFactory import TransportsFactory
|
||||
from uds.core.ui.UserInterface import gui
|
||||
from ..util.Helpers import dictFromData
|
||||
from ..auths.AdminAuth import needs_credentials
|
||||
from ..util.Exceptions import FindException
|
||||
from uds.core.Environment import Environment
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -61,8 +58,8 @@ def getTransportsTypes(credentials):
|
||||
Returns the types of services providers registered in system
|
||||
'''
|
||||
res = []
|
||||
for type in TransportsFactory.factory().providers().values():
|
||||
val = { 'name' : type.name(), 'type' : type.type(), 'description' : type.description(), 'icon' : type.icon() }
|
||||
for type_ in TransportsFactory.factory().providers().values():
|
||||
val = { 'name' : type_.name(), 'type' : type_.type(), 'description' : type_.description(), 'icon' : type_.icon() }
|
||||
res.append(val)
|
||||
return res
|
||||
|
||||
@ -81,19 +78,19 @@ def getTransports(credentials):
|
||||
|
||||
|
||||
@needs_credentials
|
||||
def getTransportGui(credentials, type):
|
||||
def getTransportGui(credentials, type_):
|
||||
'''
|
||||
Returns the description of an gui for the specified service provider
|
||||
'''
|
||||
spType = TransportsFactory.factory().lookup(type)
|
||||
spType = TransportsFactory.factory().lookup(type_)
|
||||
return spType.guiDescription()
|
||||
|
||||
@needs_credentials
|
||||
def getTransport(credentials, id):
|
||||
def getTransport(credentials, id_):
|
||||
'''
|
||||
Returns the specified service provider (at database)
|
||||
'''
|
||||
data = Transport.objects.get(pk=id)
|
||||
data = Transport.objects.get(pk=id_)
|
||||
res = [
|
||||
{ 'name' : 'name', 'value' : data.name },
|
||||
{ 'name' : 'comments', 'value' : data.comments },
|
||||
@ -109,44 +106,44 @@ def getTransport(credentials, id):
|
||||
return res
|
||||
|
||||
@needs_credentials
|
||||
def createTransport(credentials, type, data):
|
||||
def createTransport(credentials, type_, data):
|
||||
'''
|
||||
Creates a new service provider with specified type and data
|
||||
It's mandatory that data contains at least 'name' and 'comments'.
|
||||
The expected structure is the same that provided at getServiceProvider
|
||||
'''
|
||||
dict = dictFromData(data)
|
||||
dct = dictFromData(data)
|
||||
# First create data without serialization, then serialies data with correct environment
|
||||
sp = Transport.objects.create(name = dict['name'], comments = dict['comments'], data_type = type,
|
||||
priority=int(dict['priority']), nets_positive=gui.strToBool(dict['positiveNet']) )
|
||||
sp.data = sp.getInstance(dict).serialize()
|
||||
sp = Transport.objects.create(name = dct['name'], comments = dct['comments'], data_type = type_,
|
||||
priority=int(dct['priority']), nets_positive=gui.strToBool(dct['positiveNet']) )
|
||||
sp.data = sp.getInstance(dct).serialize()
|
||||
sp.save()
|
||||
return str(sp.id)
|
||||
|
||||
@needs_credentials
|
||||
def modifyTransport(credentials, id, data):
|
||||
def modifyTransport(credentials, id_, data):
|
||||
'''
|
||||
Modifies an existing service provider with specified id and data
|
||||
It's mandatory that data contains at least 'name' and 'comments'.
|
||||
The expected structure is the same that provided at getServiceProvider
|
||||
'''
|
||||
trans = Transport.objects.get(pk=id)
|
||||
dict = dictFromData(data)
|
||||
sp = trans.getInstance(dict)
|
||||
trans = Transport.objects.get(pk=id_)
|
||||
dct = dictFromData(data)
|
||||
sp = trans.getInstance(dct)
|
||||
trans.data = sp.serialize()
|
||||
trans.name = dict['name']
|
||||
trans.comments = dict['comments']
|
||||
trans.priority = int(dict['priority'])
|
||||
trans.nets_positive = gui.strToBool(dict['positiveNet'])
|
||||
trans.name = dct['name']
|
||||
trans.comments = dct['comments']
|
||||
trans.priority = int(dct['priority'])
|
||||
trans.nets_positive = gui.strToBool(dct['positiveNet'])
|
||||
trans.save()
|
||||
return True
|
||||
|
||||
@needs_credentials
|
||||
def removeTransport(credentials, id):
|
||||
def removeTransport(credentials, id_):
|
||||
'''
|
||||
Removes from database provider with specified id
|
||||
'''
|
||||
Transport.objects.get(pk=id).delete()
|
||||
Transport.objects.get(pk=id_).delete()
|
||||
return True
|
||||
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
'''
|
||||
@author: Adolfo Gómez, dkmaster at dkmon dot com
|
||||
'''
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import logging
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user