You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jumpserver/apps/tickets/migrations/0001_initial.py

194 lines
13 KiB

# Generated by Django 4.1.13 on 2024-05-09 03:16
import common.db.encoder
from django.db import migrations, models
import django.db.models.deletion
import tickets.models.ticket.general
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
('terminal', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='ApprovalRule',
fields=[
('created_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Created by')),
('updated_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Updated by')),
('date_created', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Date created')),
('date_updated', models.DateTimeField(auto_now=True, verbose_name='Date updated')),
('comment', models.TextField(blank=True, default='', verbose_name='Comment')),
('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
('level', models.SmallIntegerField(choices=[(1, 'One level'), (2, 'Two level')], default=1, verbose_name='Approve level')),
('strategy', models.CharField(choices=[('org_admin', 'Org admin'), ('custom_user', 'Custom user'), ('super_admin', 'Super admin'), ('super_org_admin', 'Super admin and org admin')], default='super_admin', max_length=64, verbose_name='Approve strategy')),
],
options={
'verbose_name': 'Ticket flow approval rule',
},
),
migrations.CreateModel(
name='Comment',
fields=[
('created_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Created by')),
('updated_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Updated by')),
('date_created', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Date created')),
('date_updated', models.DateTimeField(auto_now=True, verbose_name='Date updated')),
('comment', models.TextField(blank=True, default='', verbose_name='Comment')),
('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
('user_display', models.CharField(max_length=256, verbose_name='User display name')),
('body', models.TextField(verbose_name='Body')),
('type', models.CharField(choices=[('state', 'State'), ('common', 'common')], default='common', max_length=16, verbose_name='Type')),
('state', models.CharField(max_length=16, null=True)),
],
options={
'verbose_name': 'Comment',
'ordering': ('date_created',),
},
),
migrations.CreateModel(
name='Ticket',
fields=[
('created_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Created by')),
('updated_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Updated by')),
('date_created', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Date created')),
('date_updated', models.DateTimeField(auto_now=True, verbose_name='Date updated')),
('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
('title', models.CharField(max_length=256, verbose_name='Title')),
('type', models.CharField(choices=[('general', 'General'), ('apply_asset', 'Apply for asset'), ('login_confirm', 'Login confirm'), ('command_confirm', 'Command confirm'), ('login_asset_confirm', 'Login asset confirm')], default='general', max_length=64, verbose_name='Type')),
('state', models.CharField(choices=[('pending', 'Open'), ('closed', 'Cancel'), ('approved', 'Approved'), ('rejected', 'Rejected')], default='pending', max_length=16, verbose_name='State')),
('status', models.CharField(choices=[('open', 'Open'), ('closed', 'Finished')], default='open', max_length=16, verbose_name='Status')),
('approval_step', models.SmallIntegerField(choices=[(1, 'One level'), (2, 'Two level')], default=1, verbose_name='Approval step')),
('comment', models.TextField(blank=True, default='', verbose_name='Comment')),
('rel_snapshot', models.JSONField(default=dict, verbose_name='Relation snapshot')),
('serial_num', models.CharField(max_length=128, null=True, verbose_name='Serial number')),
('meta', models.JSONField(default=dict, encoder=common.db.encoder.ModelJSONFieldEncoder, verbose_name='Meta')),
('org_id', models.CharField(blank=True, db_index=True, default='', max_length=36, verbose_name='Organization')),
],
options={
'verbose_name': 'Ticket',
'ordering': ('-date_created',),
},
bases=(tickets.models.ticket.general.StatusMixin, models.Model),
),
migrations.CreateModel(
name='TicketAssignee',
fields=[
('created_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Created by')),
('updated_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Updated by')),
('date_created', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Date created')),
('date_updated', models.DateTimeField(auto_now=True, verbose_name='Date updated')),
('comment', models.TextField(blank=True, default='', verbose_name='Comment')),
('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
('state', models.CharField(choices=[('pending', 'Open'), ('closed', 'Cancel'), ('approved', 'Approved'), ('rejected', 'Rejected')], default='pending', max_length=64)),
],
options={
'verbose_name': 'Ticket assignee',
},
),
migrations.CreateModel(
name='ApplyAssetTicket',
fields=[
('ticket_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='tickets.ticket')),
('apply_permission_name', models.CharField(max_length=128, verbose_name='Permission name')),
('apply_accounts', models.JSONField(default=list, verbose_name='Apply accounts')),
('apply_actions', models.IntegerField(default=1, verbose_name='Actions')),
('apply_date_start', models.DateTimeField(null=True, verbose_name='Date start')),
('apply_date_expired', models.DateTimeField(null=True, verbose_name='Date expired')),
],
options={
'verbose_name': 'Apply Asset Ticket',
},
bases=('tickets.ticket',),
),
migrations.CreateModel(
name='ApplyCommandTicket',
fields=[
('ticket_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='tickets.ticket')),
('apply_run_asset', models.CharField(max_length=128, verbose_name='Run asset')),
('apply_run_command', models.CharField(max_length=4096, verbose_name='Run command')),
('apply_run_account', models.CharField(default='', max_length=128, verbose_name='Account')),
],
options={
'verbose_name': 'Apply Command Ticket',
},
bases=('tickets.ticket',),
),
migrations.CreateModel(
name='ApplyLoginAssetTicket',
fields=[
('ticket_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='tickets.ticket')),
('apply_login_account', models.CharField(default='', max_length=128, verbose_name='Login account')),
],
options={
'verbose_name': 'Apply Login Asset Ticket',
},
bases=('tickets.ticket',),
),
migrations.CreateModel(
name='ApplyLoginTicket',
fields=[
('ticket_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='tickets.ticket')),
('apply_login_ip', models.GenericIPAddressField(null=True, verbose_name='Login IP')),
('apply_login_city', models.CharField(max_length=64, null=True, verbose_name='Login city')),
('apply_login_datetime', models.DateTimeField(null=True, verbose_name='Login Date')),
],
options={
'verbose_name': 'Apply Login Ticket',
},
bases=('tickets.ticket',),
),
migrations.CreateModel(
name='TicketStep',
fields=[
('created_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Created by')),
('updated_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Updated by')),
('date_created', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Date created')),
('date_updated', models.DateTimeField(auto_now=True, verbose_name='Date updated')),
('comment', models.TextField(blank=True, default='', verbose_name='Comment')),
('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
('level', models.SmallIntegerField(choices=[(1, 'One level'), (2, 'Two level')], default=1, verbose_name='Approve level')),
('state', models.CharField(choices=[('pending', 'Pending'), ('closed', 'Closed'), ('approved', 'Approved'), ('rejected', 'Rejected')], default='pending', max_length=64, verbose_name='State')),
('status', models.CharField(choices=[('active', 'Active'), ('closed', 'Closed'), ('pending', 'Pending')], default='pending', max_length=16)),
('ticket', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ticket_steps', to='tickets.ticket', verbose_name='Ticket')),
],
options={
'verbose_name': 'Ticket step',
},
),
migrations.CreateModel(
name='TicketSession',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('session', models.ForeignKey(db_constraint=False, on_delete=django.db.models.deletion.CASCADE, related_name='ticket_relation', to='terminal.session')),
('ticket', models.ForeignKey(db_constraint=False, on_delete=django.db.models.deletion.CASCADE, related_name='session_relation', to='tickets.ticket')),
],
options={
'verbose_name': 'Ticket session relation',
},
),
migrations.CreateModel(
name='TicketFlow',
fields=[
('created_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Created by')),
('updated_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Updated by')),
('date_created', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Date created')),
('date_updated', models.DateTimeField(auto_now=True, verbose_name='Date updated')),
('comment', models.TextField(blank=True, default='', verbose_name='Comment')),
('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
('org_id', models.CharField(blank=True, db_index=True, default='', max_length=36, verbose_name='Organization')),
('type', models.CharField(choices=[('general', 'General'), ('apply_asset', 'Apply for asset'), ('login_confirm', 'Login confirm'), ('command_confirm', 'Command confirm'), ('login_asset_confirm', 'Login asset confirm')], default='general', max_length=64, verbose_name='Type')),
('approval_level', models.SmallIntegerField(choices=[(1, 'One level'), (2, 'Two level')], default=1, verbose_name='Approve level')),
('rules', models.ManyToManyField(related_name='ticket_flows', to='tickets.approvalrule')),
],
options={
'verbose_name': 'Ticket flow',
},
),
]