2021-09-27 11:06:26 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
from django.utils.translation import ugettext_lazy as _
|
2022-11-10 06:44:23 +00:00
|
|
|
from django.db.models import TextChoices, IntegerChoices
|
2021-09-27 11:06:26 +00:00
|
|
|
|
|
|
|
DEFAULT_CITY = _("Unknown")
|
2022-05-05 06:42:09 +00:00
|
|
|
|
|
|
|
MODELS_NEED_RECORD = (
|
|
|
|
# users
|
|
|
|
'User', 'UserGroup',
|
2022-11-04 06:22:38 +00:00
|
|
|
# authentication
|
|
|
|
'AccessKey', 'TempToken',
|
2022-11-11 07:11:10 +00:00
|
|
|
"User",
|
|
|
|
"UserGroup",
|
2022-05-05 06:42:09 +00:00
|
|
|
# acls
|
2022-11-11 07:11:10 +00:00
|
|
|
"LoginACL",
|
|
|
|
"LoginAssetACL",
|
|
|
|
"LoginConfirmSetting",
|
2022-05-05 06:42:09 +00:00
|
|
|
# assets
|
2022-12-27 09:45:41 +00:00
|
|
|
'Asset', 'Node', 'Domain', 'Gateway', 'CommandFilterRule',
|
2022-11-04 06:22:38 +00:00
|
|
|
'CommandFilter', 'Platform', 'Label',
|
2022-11-14 00:19:32 +00:00
|
|
|
# account
|
2022-12-27 09:45:41 +00:00
|
|
|
'Account',
|
2022-05-05 06:42:09 +00:00
|
|
|
# orgs
|
2022-11-11 07:11:10 +00:00
|
|
|
"Organization",
|
2022-05-05 06:42:09 +00:00
|
|
|
# settings
|
2022-11-11 07:11:10 +00:00
|
|
|
"Setting",
|
2022-05-05 06:42:09 +00:00
|
|
|
# perms
|
2022-12-05 07:03:21 +00:00
|
|
|
'AssetPermission',
|
2022-11-04 06:22:38 +00:00
|
|
|
# notifications
|
|
|
|
'SystemMsgSubscription', 'UserMsgSubscription',
|
|
|
|
# Terminal
|
|
|
|
'Terminal', 'Endpoint', 'EndpointRule', 'CommandStorage', 'ReplayStorage',
|
|
|
|
# rbac
|
|
|
|
'Role', 'SystemRole', 'OrgRole', 'RoleBinding', 'OrgRoleBinding', 'SystemRoleBinding',
|
2022-05-05 06:42:09 +00:00
|
|
|
# xpack
|
2022-12-27 09:45:41 +00:00
|
|
|
'License', 'Account', 'SyncInstanceTask', 'Interface',
|
2022-05-05 06:42:09 +00:00
|
|
|
)
|
2022-11-10 06:44:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
class OperateChoices(TextChoices):
|
2022-11-11 07:11:10 +00:00
|
|
|
mkdir = "mkdir", _("Mkdir")
|
|
|
|
rmdir = "rmdir", _("Rmdir")
|
|
|
|
delete = "delete", _("Delete")
|
|
|
|
upload = "upload", _("Upload")
|
|
|
|
rename = "rename", _("Rename")
|
|
|
|
symlink = "symlink", _("Symlink")
|
|
|
|
download = "download", _("Download")
|
2022-11-10 06:44:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ActionChoices(TextChoices):
|
2022-11-11 07:11:10 +00:00
|
|
|
view = "view", _("View")
|
|
|
|
update = "update", _("Update")
|
|
|
|
delete = "delete", _("Delete")
|
|
|
|
create = "create", _("Create")
|
2022-11-10 06:44:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
class LoginTypeChoices(TextChoices):
|
2022-11-11 07:11:10 +00:00
|
|
|
web = "W", _("Web")
|
|
|
|
terminal = "T", _("Terminal")
|
|
|
|
unknown = "U", _("Unknown")
|
2022-11-10 06:44:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
class MFAChoices(IntegerChoices):
|
2022-11-11 07:11:10 +00:00
|
|
|
disabled = 0, _("Disabled")
|
|
|
|
enabled = 1, _("Enabled")
|
|
|
|
unknown = 2, _("-")
|
2022-11-10 06:44:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
class LoginStatusChoices(IntegerChoices):
|
2022-11-11 07:11:10 +00:00
|
|
|
success = True, _("Success")
|
|
|
|
failed = False, _("Failed")
|