jumpserver/apps/perms/migrations/0001_initial.py

105 lines
5.0 KiB
Python

# Generated by Django 4.1.13 on 2024-05-09 03:16
import assets.models.node
import common.utils.django
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import perms.models.asset_permission
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
('assets', '0001_initial'),
('accounts', '0002_auto_20220616_0021'),
]
operations = [
migrations.CreateModel(
name='AssetPermission',
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')),
('name', models.CharField(max_length=128, verbose_name='Name')),
('accounts', models.JSONField(default=list, verbose_name='Account')),
('protocols', models.JSONField(default=perms.models.asset_permission.default_protocols, verbose_name='Protocols')),
('actions', models.IntegerField(default=1, verbose_name='Actions')),
('date_start', models.DateTimeField(db_index=True, default=django.utils.timezone.now, verbose_name='Date start')),
('date_expired', models.DateTimeField(db_index=True, default=common.utils.django.date_expired_default, verbose_name='Date expired')),
('is_active', models.BooleanField(default=True, verbose_name='Active')),
('from_ticket', models.BooleanField(default=False, verbose_name='From ticket')),
],
options={
'verbose_name': 'Asset permission',
'ordering': ('name',),
'permissions': [],
},
),
migrations.CreateModel(
name='PermedAccount',
fields=[
],
options={
'verbose_name': 'Permed account',
'proxy': True,
'indexes': [],
'constraints': [],
},
bases=('accounts.account',),
),
migrations.CreateModel(
name='PermedAsset',
fields=[
],
options={
'verbose_name': 'Permed asset',
'permissions': [('view_myassets', 'Can view my assets'), ('view_userassets', 'Can view user assets'), ('view_usergroupassets', 'Can view usergroup assets')],
'proxy': True,
'indexes': [],
'constraints': [],
},
bases=('assets.asset',),
),
migrations.CreateModel(
name='PermNode',
fields=[
],
options={
'ordering': [],
'proxy': True,
'indexes': [],
'constraints': [],
},
bases=('assets.node',),
),
migrations.CreateModel(
name='UserAssetGrantedTreeNodeRelation',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('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')),
('org_id', models.CharField(blank=True, db_index=True, default='', max_length=36, verbose_name='Organization')),
('node_key', models.CharField(db_index=True, max_length=64, verbose_name='Key')),
('node_parent_key', models.CharField(db_index=True, default='', max_length=64, verbose_name='Parent key')),
('node_from', models.CharField(choices=[('granted', 'Direct node granted'), ('child', 'Have children node'), ('asset', 'Direct asset granted')], db_index=True, max_length=16)),
('node_assets_amount', models.IntegerField(default=0)),
('node', models.ForeignKey(db_constraint=False, default=None, on_delete=django.db.models.deletion.CASCADE, related_name='granted_node_rels', to='assets.node')),
],
options={
'abstract': False,
},
bases=(assets.models.node.FamilyMixin, models.Model),
),
]