mirror of https://github.com/jumpserver/jumpserver
77 lines
5.2 KiB
Python
77 lines
5.2 KiB
Python
# Generated by Django 3.1.12 on 2021-08-26 09:07
|
|
|
|
import assets.models.base
|
|
import common.fields.model
|
|
from django.conf import settings
|
|
import django.core.validators
|
|
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', '0076_delete_assetuser'),
|
|
('applications', '0009_applicationuser'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='HistoricalAccount',
|
|
fields=[
|
|
('org_id', models.CharField(blank=True, db_index=True, default='', max_length=36, verbose_name='Organization')),
|
|
('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, validators=[django.core.validators.RegexValidator('^[0-9a-zA-Z_@\\-\\.]*$', 'Special char not allowed')], verbose_name='Username')),
|
|
('password', common.fields.model.EncryptCharField(blank=True, max_length=256, null=True, verbose_name='Password')),
|
|
('private_key', common.fields.model.EncryptTextField(blank=True, null=True, verbose_name='SSH private key')),
|
|
('public_key', common.fields.model.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')),
|
|
('version', models.IntegerField(default=1, verbose_name='Version')),
|
|
('history_id', models.AutoField(primary_key=True, serialize=False)),
|
|
('history_date', models.DateTimeField()),
|
|
('history_change_reason', models.CharField(max_length=100, null=True)),
|
|
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
|
|
('app', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='applications.application', verbose_name='Database')),
|
|
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
|
|
('systemuser', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='assets.systemuser', verbose_name='System user')),
|
|
],
|
|
options={
|
|
'verbose_name': 'historical Account',
|
|
'ordering': ('-history_date', '-history_id'),
|
|
'get_latest_by': 'history_date',
|
|
},
|
|
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')),
|
|
('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, validators=[django.core.validators.RegexValidator('^[0-9a-zA-Z_@\\-\\.]*$', 'Special char not allowed')], verbose_name='Username')),
|
|
('password', common.fields.model.EncryptCharField(blank=True, max_length=256, null=True, verbose_name='Password')),
|
|
('private_key', common.fields.model.EncryptTextField(blank=True, null=True, verbose_name='SSH private key')),
|
|
('public_key', common.fields.model.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')),
|
|
('version', models.IntegerField(default=1, verbose_name='Version')),
|
|
('app', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='applications.application', verbose_name='Database')),
|
|
('systemuser', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='assets.systemuser', verbose_name='System user')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Account',
|
|
'unique_together': {('username', 'app', 'systemuser')},
|
|
},
|
|
bases=(models.Model, assets.models.base.AuthMixin),
|
|
),
|
|
]
|