perf: 优化 acl 默认排序

pull/10727/head
ibuler 2023-06-15 10:45:07 +08:00
parent c6e19a2989
commit e92c82568d
8 changed files with 13 additions and 14 deletions

View File

@ -38,7 +38,7 @@ class Migration(migrations.Migration):
to=settings.AUTH_USER_MODEL, verbose_name='User')),
],
options={
'ordering': ('priority', 'name'),
'ordering': ('priority', '-is_active', 'name'),
},
),
migrations.CreateModel(
@ -68,7 +68,7 @@ class Migration(migrations.Migration):
verbose_name='Reviewers')),
],
options={
'ordering': ('priority', 'name'),
'ordering': ('priority', '-is_active', 'name'),
'unique_together': {('name', 'org_id')},
},
),

View File

@ -89,10 +89,10 @@ class Migration(migrations.Migration):
),
migrations.AlterModelOptions(
name='loginacl',
options={'ordering': ('priority', 'name'), 'verbose_name': 'Login acl'},
options={'ordering': ('priority', '-is_active', 'name'), 'verbose_name': 'Login acl'},
),
migrations.AlterModelOptions(
name='loginassetacl',
options={'ordering': ('priority', 'name'), 'verbose_name': 'Login asset acl'},
options={'ordering': ('priority', '-is_active', 'name'), 'verbose_name': 'Login asset acl'},
),
]

View File

@ -11,10 +11,10 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterModelOptions(
name='loginacl',
options={'ordering': ('priority', 'name'), 'verbose_name': 'Login acl'},
options={'ordering': ('priority', '-is_active', 'name'), 'verbose_name': 'Login acl'},
),
migrations.AlterModelOptions(
name='loginassetacl',
options={'ordering': ('priority', 'name'), 'verbose_name': 'Login asset acl'},
options={'ordering': ('priority', '-is_active', 'name'), 'verbose_name': 'Login asset acl'},
),
]

View File

@ -63,7 +63,7 @@ class Migration(migrations.Migration):
],
options={
'verbose_name': 'Command acl',
'ordering': ('priority', 'name'),
'ordering': ('priority', '-is_active', 'name'),
'unique_together': {('name', 'org_id')},
},
),

View File

@ -20,14 +20,14 @@ class Migration(migrations.Migration):
),
migrations.AlterModelOptions(
name='commandfilteracl',
options={'ordering': ('priority', 'name'), 'verbose_name': 'Command acl'},
options={'ordering': ('priority', '-is_active', 'name'), 'verbose_name': 'Command acl'},
),
migrations.AlterModelOptions(
name='loginacl',
options={'ordering': ('priority', 'name'), 'verbose_name': 'Login acl'},
options={'ordering': ('priority', '-is_active', 'name'), 'verbose_name': 'Login acl'},
),
migrations.AlterModelOptions(
name='loginassetacl',
options={'ordering': ('priority', 'name'), 'verbose_name': 'Login asset acl'},
options={'ordering': ('priority', '-is_active', 'name'), 'verbose_name': 'Login asset acl'},
),
]

View File

@ -39,7 +39,7 @@ class Migration(migrations.Migration):
models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL, verbose_name='Reviewers')),
],
options={
'ordering': ('priority', 'name'),
'ordering': ('priority', '-is_active', 'name'),
'abstract': False,
},
),

View File

@ -4,7 +4,6 @@ from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('acls', '0016_auto_20230606_1857'),
]
@ -12,6 +11,6 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterModelOptions(
name='connectmethodacl',
options={'ordering': ('priority', 'name'), 'verbose_name': 'Connect method acl'},
options={'ordering': ('priority', '-is_active', 'name'), 'verbose_name': 'Connect method acl'},
),
]

View File

@ -51,7 +51,7 @@ class BaseACL(JMSBaseModel):
objects = BaseACLQuerySet.as_manager()
class Meta:
ordering = ('priority', 'name')
ordering = ('priority', '-is_active', 'name')
abstract = True
def is_action(self, action):