mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-06-26 06:52:53 +00:00
account template model
This commit is contained in:
parent
4021baf758
commit
a748f5d57d
16
apps/assets/migrations/0107_delete_accounttemplate.py
Normal file
16
apps/assets/migrations/0107_delete_accounttemplate.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Generated by Django 3.2.13 on 2022-08-11 09:34
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('assets', '0106_auto_20220811_1358'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name='AccountTemplate',
|
||||||
|
),
|
||||||
|
]
|
39
apps/assets/migrations/0108_accounttemplate.py
Normal file
39
apps/assets/migrations/0108_accounttemplate.py
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# Generated by Django 3.2.13 on 2022-08-11 09:34
|
||||||
|
|
||||||
|
import assets.models.base
|
||||||
|
import common.db.fields
|
||||||
|
from django.db import migrations, models
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('assets', '0107_delete_accounttemplate'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='AccountTemplate',
|
||||||
|
fields=[
|
||||||
|
('org_id', models.CharField(blank=True, db_index=True, default='', max_length=36, verbose_name='Organization')),
|
||||||
|
('connectivity', models.CharField(choices=[('unknown', 'Unknown'), ('ok', 'Ok'), ('failed', 'Failed')], default='unknown', max_length=16, verbose_name='Connectivity')),
|
||||||
|
('date_verified', models.DateTimeField(null=True, verbose_name='Date verified')),
|
||||||
|
('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')),
|
||||||
|
('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')),
|
||||||
|
('type', models.CharField(choices=[('common', 'Common user'), ('admin', 'Admin user')], default='common', max_length=16, verbose_name='Type')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name': 'Account Template',
|
||||||
|
},
|
||||||
|
bases=(models.Model, assets.models.base.AuthMixin),
|
||||||
|
),
|
||||||
|
]
|
@ -5,7 +5,6 @@ from simple_history.models import HistoricalRecords
|
|||||||
from common.db.models import JMSBaseModel
|
from common.db.models import JMSBaseModel
|
||||||
from .base import BaseUser, AbsConnectivity
|
from .base import BaseUser, AbsConnectivity
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['Account']
|
__all__ = ['Account']
|
||||||
|
|
||||||
|
|
||||||
@ -33,5 +32,13 @@ class Account(BaseUser, AbsConnectivity):
|
|||||||
return '{}@{}'.format(self.username, self.asset.hostname)
|
return '{}@{}'.format(self.username, self.asset.hostname)
|
||||||
|
|
||||||
|
|
||||||
class AccountTemplate(JMSBaseModel):
|
class AccountTemplate(BaseUser, AbsConnectivity):
|
||||||
pass
|
type = models.CharField(
|
||||||
|
max_length=16, choices=Account.Type.choices, default=Account.Type.common, verbose_name=_("Type")
|
||||||
|
)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = _('Account Template')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return '{}'.format(self.username)
|
||||||
|
Loading…
Reference in New Issue
Block a user