jumpserver/apps/assets/migrations/0099_auto_20220711_1409.py

109 lines
6.4 KiB
Python
Raw Normal View History

2022-07-14 02:56:09 +00:00
# Generated by Django 3.2.12 on 2022-07-11 08:59
2022-07-12 02:54:23 +00:00
import uuid
2022-07-12 02:54:23 +00:00
import django.db.models.deletion
import simple_history.models
from django.conf import settings
from django.db import migrations, models
2022-07-12 02:54:23 +00:00
import common.db.fields
2022-07-12 02:54:23 +00:00
class Migration(migrations.Migration):
2022-07-12 02:54:23 +00:00
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
2022-08-24 08:14:32 +00:00
('assets', '0098_auto_20220430_2126'),
2022-07-12 02:54:23 +00:00
]
operations = [
migrations.CreateModel(
name='HistoricalAccount',
fields=[
('id', models.UUIDField(db_index=True, default=uuid.uuid4)),
('secret_type', models.CharField(
choices=[('password', 'Password'), ('ssh_key', 'SSH key'), ('access_key', 'Access key'),
('token', 'Token')], default='password', max_length=16, verbose_name='Secret type')),
2022-09-20 05:54:25 +00:00
('secret', common.db.fields.EncryptTextField(blank=True, null=True, verbose_name='Secret')),
2022-10-27 08:26:15 +00:00
('version', models.IntegerField(default=0, verbose_name='Version'),),
2022-07-12 02:54:23 +00:00
('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)),
('history_user',
models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+',
to=settings.AUTH_USER_MODEL)),
2022-07-12 02:54:23 +00:00
],
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')),
2022-07-12 02:54:23 +00:00
('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
2022-09-13 13:07:20 +00:00
('name', models.CharField(max_length=128, verbose_name='Name')),
2022-07-12 02:54:23 +00:00
('username', models.CharField(blank=True, db_index=True, max_length=128, verbose_name='Username')),
('secret_type', models.CharField(
choices=[('password', 'Password'), ('ssh_key', 'SSH key'), ('access_key', 'Access key'),
('token', 'Token')], default='password', max_length=16, verbose_name='Secret type')),
2022-09-20 05:54:25 +00:00
('secret', common.db.fields.EncryptTextField(blank=True, null=True, verbose_name='Secret')),
('comment', models.TextField(blank=True, default='', verbose_name='Comment')),
('connectivity', models.CharField(choices=[('unknown', 'Unknown'), ('ok', 'Ok'), ('failed', 'Failed')],
default='unknown', max_length=16, verbose_name='Connectivity')),
2022-10-27 08:26:15 +00:00
('date_verified', models.DateTimeField(null=True, verbose_name='Date verified')),
2022-07-12 02:54:23 +00:00
('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')),
2022-09-15 13:20:56 +00:00
('privileged', models.BooleanField(default=False, verbose_name='Privileged')),
2022-07-15 10:57:52 +00:00
('version', models.IntegerField(default=0, verbose_name='Version')),
('asset', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='accounts',
to='assets.asset', verbose_name='Asset')),
2022-07-12 02:54:23 +00:00
],
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')],
2022-09-20 05:54:25 +00:00
'unique_together': {('name', 'asset'), ('username', 'asset', 'secret_type')},
2022-07-12 02:54:23 +00:00
},
),
2022-09-16 03:45:50 +00:00
migrations.AddField(
model_name='account',
name='su_from',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='su_to',
to='assets.account', verbose_name='Su from'),
2022-09-16 03:45:50 +00:00
),
2022-09-22 07:24:32 +00:00
migrations.CreateModel(
name='AccountTemplate',
fields=[
('org_id',
models.CharField(blank=True, db_index=True, default='', max_length=36, verbose_name='Organization')),
2022-09-22 07:24:32 +00:00
('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')),
('secret_type', models.CharField(
choices=[('password', 'Password'), ('ssh_key', 'SSH key'), ('access_key', 'Access key'),
('token', 'Token')], default='password', max_length=16, verbose_name='Secret type'),),
2022-09-22 07:24:32 +00:00
('secret', common.db.fields.EncryptTextField(blank=True, null=True, verbose_name='Secret')),
('comment', models.TextField(blank=True, default='', verbose_name='Comment')),
2022-09-22 07:24:32 +00:00
('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')),
('privileged', models.BooleanField(default=False, verbose_name='Privileged')),
],
options={
'verbose_name': 'Account template',
'unique_together': {('name', 'org_id')},
},
),
2022-07-12 02:54:23 +00:00
]