mirror of https://github.com/jumpserver/jumpserver
77 lines
5.2 KiB
Python
77 lines
5.2 KiB
Python
# Generated by Django 3.2.12 on 2022-07-11 08:59
|
|
|
|
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', '0098_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')),
|
|
('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')),
|
|
('token', common.db.fields.EncryptTextField(blank=True, null=True, verbose_name='Token')),
|
|
('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')),
|
|
('privileged', models.BooleanField(default=False, verbose_name='Privileged account')),
|
|
('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')),
|
|
('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')),
|
|
('token', common.db.fields.EncryptTextField(blank=True, null=True, verbose_name='Token')),
|
|
('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')),
|
|
('privileged', models.BooleanField(default=False, verbose_name='Privileged account')),
|
|
('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'), ('name', 'asset')},
|
|
},
|
|
),
|
|
]
|