Merge branch 'v3' of github.com:jumpserver/jumpserver into v3

t po v3# 以 '#' 开始的行将被忽略,而空的提交说明将终止提交。
pull/8873/head
ibuler 2022-08-15 18:45:56 +08:00
commit 31eadd3dc9
3 changed files with 65 additions and 3 deletions

View 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',
),
]

View 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),
),
]

View File

@ -6,7 +6,6 @@ from common.db.models import JMSBaseModel
from common.db import fields
from .base import BaseUser, AbsConnectivity
__all__ = ['Account']
@ -31,5 +30,13 @@ class Account(BaseUser, AbsConnectivity):
return '{}@{}'.format(self.username, self.asset.name)
class AccountTemplate(JMSBaseModel):
pass
class AccountTemplate(BaseUser, AbsConnectivity):
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)