perf: 优化控制 ACL Action Choices 的选项

This commit is contained in:
Bai
2023-07-17 15:53:35 +08:00
committed by Bryan
parent 819853eae4
commit 7b9c4b300d
7 changed files with 42 additions and 40 deletions

View File

@@ -7,23 +7,16 @@ from common.db.models import JMSBaseModel
from common.utils import contains_ip
from common.utils.time_period import contains_time_period
from orgs.mixins.models import OrgModelMixin, OrgManager
from ..const import ActionChoices
__all__ = [
'BaseACL', 'UserBaseACL', 'UserAssetAccountBaseACL',
'ActionChoices',
]
from orgs.utils import tmp_to_root_org
from orgs.utils import tmp_to_org
class ActionChoices(models.TextChoices):
reject = 'reject', _('Reject')
accept = 'accept', _('Accept')
review = 'review', _('Review')
warning = 'warning', _('Warning')
class BaseACLQuerySet(models.QuerySet):
def active(self):
return self.filter(is_active=True)