mirror of https://github.com/jumpserver/jumpserver
83 lines
6.4 KiB
Python
83 lines
6.4 KiB
Python
|
# Generated by Django 3.2.12 on 2022-07-11 08:59
|
||
|
|
||
|
import assets.models.base
|
||
|
import common.db.fields
|
||
|
from django.conf import settings
|
||
|
from django.db import migrations, models
|
||
|
import django.db.models.deletion
|
||
|
import simple_history.models
|
||
|
import uuid
|
||
|
|
||
|
|
||
|
class Migration(migrations.Migration):
|
||
|
|
||
|
dependencies = [
|
||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||
|
('assets', '0100_auto_20220430_2126'),
|
||
|
]
|
||
|
|
||
|
operations = [
|
||
|
migrations.CreateModel(
|
||
|
name='HistoricalAccount',
|
||
|
fields=[
|
||
|
('org_id', models.CharField(blank=True, db_index=True, default='', max_length=36, verbose_name='Organization')),
|
||
|
('connectivity', models.CharField(choices=[('unknown', 'Unknown'), ('ok', 'Ok'), ('failed', 'Failed')], default='unknown', max_length=16, verbose_name='Connectivity')),
|
||
|
('date_verified', models.DateTimeField(null=True, verbose_name='Date verified')),
|
||
|
('id', models.UUIDField(db_index=True, default=uuid.uuid4)),
|
||
|
('name', models.CharField(max_length=128, verbose_name='Name')),
|
||
|
('username', models.CharField(blank=True, db_index=True, max_length=128, verbose_name='Username')),
|
||
|
('password', common.db.fields.EncryptCharField(blank=True, max_length=256, null=True, verbose_name='Password')),
|
||
|
('private_key', common.db.fields.EncryptTextField(blank=True, null=True, verbose_name='SSH private key')),
|
||
|
('public_key', common.db.fields.EncryptTextField(blank=True, null=True, verbose_name='SSH public key')),
|
||
|
('comment', models.TextField(blank=True, verbose_name='Comment')),
|
||
|
('date_created', models.DateTimeField(blank=True, editable=False, verbose_name='Date created')),
|
||
|
('date_updated', models.DateTimeField(blank=True, editable=False, verbose_name='Date updated')),
|
||
|
('created_by', models.CharField(max_length=128, null=True, verbose_name='Created by')),
|
||
|
('protocol', models.CharField(choices=[('ssh', 'SSH'), ('rdp', 'RDP'), ('telnet', 'Telnet'), ('vnc', 'VNC'), ('mysql', 'MySQL'), ('oracle', 'Oracle'), ('mariadb', 'MariaDB'), ('postgresql', 'PostgreSQL'), ('sqlserver', 'SQLServer'), ('redis', 'Redis'), ('mongodb', 'MongoDB'), ('k8s', 'K8S')], default='ssh', max_length=16, verbose_name='Protocol')),
|
||
|
('type', models.CharField(choices=[('common', 'Common user'), ('admin', 'Admin user')], default='common', max_length=16, verbose_name='Type')),
|
||
|
('version', models.IntegerField(default=0, verbose_name='Version')),
|
||
|
('history_id', models.AutoField(primary_key=True, serialize=False)),
|
||
|
('history_date', models.DateTimeField(db_index=True)),
|
||
|
('history_change_reason', models.CharField(max_length=100, null=True)),
|
||
|
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
|
||
|
('asset', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='assets.asset', verbose_name='Asset')),
|
||
|
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
|
||
|
],
|
||
|
options={
|
||
|
'verbose_name': 'historical Account',
|
||
|
'verbose_name_plural': 'historical Accounts',
|
||
|
'ordering': ('-history_date', '-history_id'),
|
||
|
'get_latest_by': ('history_date', 'history_id'),
|
||
|
},
|
||
|
bases=(simple_history.models.HistoricalChanges, models.Model),
|
||
|
),
|
||
|
migrations.CreateModel(
|
||
|
name='Account',
|
||
|
fields=[
|
||
|
('org_id', models.CharField(blank=True, db_index=True, default='', max_length=36, verbose_name='Organization')),
|
||
|
('connectivity', models.CharField(choices=[('unknown', 'Unknown'), ('ok', 'Ok'), ('failed', 'Failed')], default='unknown', max_length=16, verbose_name='Connectivity')),
|
||
|
('date_verified', models.DateTimeField(null=True, verbose_name='Date verified')),
|
||
|
('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
|
||
|
('name', models.CharField(max_length=128, verbose_name='Name')),
|
||
|
('username', models.CharField(blank=True, db_index=True, max_length=128, verbose_name='Username')),
|
||
|
('password', common.db.fields.EncryptCharField(blank=True, max_length=256, null=True, verbose_name='Password')),
|
||
|
('private_key', common.db.fields.EncryptTextField(blank=True, null=True, verbose_name='SSH private key')),
|
||
|
('public_key', common.db.fields.EncryptTextField(blank=True, null=True, verbose_name='SSH public key')),
|
||
|
('comment', models.TextField(blank=True, verbose_name='Comment')),
|
||
|
('date_created', models.DateTimeField(auto_now_add=True, verbose_name='Date created')),
|
||
|
('date_updated', models.DateTimeField(auto_now=True, verbose_name='Date updated')),
|
||
|
('created_by', models.CharField(max_length=128, null=True, verbose_name='Created by')),
|
||
|
('protocol', models.CharField(choices=[('ssh', 'SSH'), ('rdp', 'RDP'), ('telnet', 'Telnet'), ('vnc', 'VNC'), ('mysql', 'MySQL'), ('oracle', 'Oracle'), ('mariadb', 'MariaDB'), ('postgresql', 'PostgreSQL'), ('sqlserver', 'SQLServer'), ('redis', 'Redis'), ('mongodb', 'MongoDB'), ('k8s', 'K8S')], default='ssh', max_length=16, verbose_name='Protocol')),
|
||
|
('type', models.CharField(choices=[('common', 'Common user'), ('admin', 'Admin user')], default='common', max_length=16, verbose_name='Type')),
|
||
|
('version', models.IntegerField(default=0, verbose_name='Version')),
|
||
|
('asset', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assets.asset', verbose_name='Asset')),
|
||
|
],
|
||
|
options={
|
||
|
'verbose_name': 'Account',
|
||
|
'permissions': [('view_accountsecret', 'Can view asset account secret'), ('change_accountsecret', 'Can change asset account secret'), ('view_historyaccount', 'Can view asset history account'), ('view_historyaccountsecret', 'Can view asset history account secret')],
|
||
|
'unique_together': {('username', 'asset')},
|
||
|
},
|
||
|
bases=(models.Model, assets.models.base.AuthMixin, assets.models.protocol.ProtocolMixin),
|
||
|
),
|
||
|
]
|