mirror of https://github.com/jumpserver/jumpserver
perf: 修改 Connect acl
parent
6390b9c203
commit
61e6ab20a2
|
@ -1,7 +1,7 @@
|
|||
from orgs.mixins.api import OrgBulkModelViewSet
|
||||
from .. import models, serializers
|
||||
|
||||
__all__ = ['CommandFilterACLViewSet']
|
||||
__all__ = ['CommandFilterACLViewSet', 'CommandGroupViewSet']
|
||||
|
||||
|
||||
class CommandGroupViewSet(OrgBulkModelViewSet):
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
# Generated by Django 3.2.16 on 2022-11-30 02:46
|
||||
|
||||
from django.conf import settings
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
import uuid
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('users', '0040_alter_user_source'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('acls', '0003_auto_20211130_1037'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='ConnectACL',
|
||||
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)),
|
||||
('created_by', models.CharField(blank=True, max_length=32, null=True, verbose_name='Created 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')),
|
||||
('name', models.CharField(max_length=128, verbose_name='Name')),
|
||||
('priority', models.IntegerField(default=50, help_text='1-100, the lower the value will be match first', validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100)], verbose_name='Priority')),
|
||||
('is_active', models.BooleanField(default=True, verbose_name='Active')),
|
||||
('comment', models.TextField(blank=True, default='', verbose_name='Comment')),
|
||||
('rules', models.JSONField(default=list, verbose_name='Rule')),
|
||||
('action', models.CharField(choices=[('reject', 'Reject'), ('allow', 'Allow')], default='reject', max_length=64, verbose_name='Action')),
|
||||
('user_groups', models.ManyToManyField(blank=True, related_name='connect_acls', to='users.UserGroup', verbose_name='User group')),
|
||||
('users', models.ManyToManyField(blank=True, related_name='connect_acls', to=settings.AUTH_USER_MODEL, verbose_name='User')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Connect acl',
|
||||
'ordering': ('priority', '-date_updated', 'name'),
|
||||
},
|
||||
),
|
||||
]
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.2.14 on 2022-12-02 04:25
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('acls', '0007_auto_20221202_1048'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='commandgroup',
|
||||
name='comment',
|
||||
field=models.TextField(blank=True, verbose_name='Comment'),
|
||||
),
|
||||
]
|
|
@ -24,6 +24,7 @@ class CommandGroup(JMSOrgBaseModel):
|
|||
type = models.CharField(max_length=16, default=Type.command, choices=Type.choices, verbose_name=_("Type"))
|
||||
content = models.TextField(verbose_name=_("Content"), help_text=_("One line one command"))
|
||||
ignore_case = models.BooleanField(default=True, verbose_name=_('Ignore case'))
|
||||
comment = models.TextField(blank=True, verbose_name=_("Comment"))
|
||||
|
||||
class Meta:
|
||||
unique_together = [('org_id', 'name')]
|
||||
|
|
|
@ -8,6 +8,7 @@ app_name = 'acls'
|
|||
router = BulkRouter()
|
||||
router.register(r'login-acls', api.LoginACLViewSet, 'login-acl')
|
||||
router.register(r'login-asset-acls', api.LoginAssetACLViewSet, 'login-asset-acl')
|
||||
router.register(r'command-groups', api.CommandGroupViewSet, 'command-group')
|
||||
router.register(r'command-filter-acls', api.CommandFilterACLViewSet, 'command-filter-acl')
|
||||
|
||||
urlpatterns = [
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
# Generated by Django 3.2.16 on 2022-11-30 07:36
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('audits', '0015_auto_20221111_1919'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='userloginlog',
|
||||
name='type',
|
||||
field=models.CharField(choices=[('web_cli', 'Web Client'), ('web_gui', 'Web GUI'), ('db_cli', 'DB Client'),
|
||||
('db_gui', 'DB GUI'), ('rdp_cli', 'RDP Client'), ('rdp_file', 'RDP File'),
|
||||
('ssh_cli', 'SSH Client'), ('web_sftp', 'Web SFTP')], max_length=128,
|
||||
verbose_name='Login type'),
|
||||
),
|
||||
]
|
Loading…
Reference in New Issue