Added computername to actortoken db

This commit is contained in:
Adolfo Gómez García 2019-11-22 11:01:41 +01:00
parent d6691a4098
commit 52335b6e31
5 changed files with 10 additions and 3 deletions

View File

@ -115,6 +115,7 @@ class UDSConfigDialog(QDialog):
self.ui.authenticators.currentData().auth,
self.ui.username.text(),
self.ui.password.text(),
udsactor.operations.getComputerName(),
data.ip or '', # IP
data.mac or '', # MAC
self.ui.preCommand.text(),

View File

@ -137,11 +137,12 @@ class REST:
pass
def register( #pylint: disable=too-many-arguments
def register( #pylint: disable=too-many-arguments, too-many-locals
self,
auth: str,
username: str,
password: str,
hostname: str,
ip: str,
mac: str,
preCommand: str,
@ -154,6 +155,7 @@ class REST:
"""
data = {
'username': username,
'hostname': hostname,
'ip': ip,
'mac': mac,
'pre_command': preCommand,

View File

@ -37,7 +37,7 @@ import typing
from uds.models import getSqlDatetimeAsUnix, getSqlDatetime, ActorToken
from uds.core import VERSION
from ..handlers import Handler, NotFound
from ..handlers import Handler
logger = logging.getLogger(__name__)
@ -87,6 +87,7 @@ class ActorV2Register(ActorV2Action):
# Update parameters
actorToken.ip_from = self._request.ip
actorToken.ip = self._params['ip']
actorToken.hostname = self._params['hostname']
actorToken.pre_command = self._params['pre_command']
actorToken.post_command = self._params['post_command']
actorToken.runonce_command = self._params['run_once_command']
@ -98,6 +99,7 @@ class ActorV2Register(ActorV2Action):
username=self._params['username'],
ip_from=self._request.ip,
ip=self._params['ip'],
hostname=self._params['hostname'],
mac=self._params['mac'],
pre_command=self._params['pre_command'],
post_command=self._params['post_command'],

View File

@ -1,4 +1,4 @@
# Generated by Django 2.2.7 on 2019-11-21 12:22
# Generated by Django 2.2.7 on 2019-11-22 10:54
from django.db import migrations, models
@ -17,6 +17,7 @@ class Migration(migrations.Migration):
('username', models.CharField(max_length=128)),
('ip_from', models.CharField(max_length=128)),
('ip', models.CharField(max_length=128)),
('hostname', models.CharField(max_length=128)),
('mac', models.CharField(db_index=True, max_length=128, unique=True)),
('pre_command', models.CharField(blank=True, default='', max_length=255)),
('post_command', models.CharField(blank=True, default='', max_length=255)),

View File

@ -37,6 +37,7 @@ class ActorToken(models.Model):
username = models.CharField(max_length=128)
ip_from = models.CharField(max_length=128)
ip = models.CharField(max_length=128)
hostname = models.CharField(max_length=128)
mac = models.CharField(max_length=128, db_index=True, unique=True)
pre_command = models.CharField(max_length=255, blank=True, default='')
post_command = models.CharField(max_length=255, blank=True, default='')