jumpserver/apps/audits/const.py

76 lines
1.8 KiB
Python
Raw Normal View History

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")
MODELS_NEED_RECORD = (
# users
'User', 'UserGroup',
# authentication
'AccessKey', 'TempToken',
2022-11-11 07:11:10 +00:00
"User",
"UserGroup",
# acls
2022-11-11 07:11:10 +00:00
"LoginACL",
"LoginAssetACL",
"LoginConfirmSetting",
# assets
'Asset', 'Node', 'AdminUser', 'SystemUser', 'Domain', 'Gateway', 'CommandFilterRule',
'CommandFilter', 'Platform', 'Label',
# applications
'Application',
2022-11-14 00:19:32 +00:00
# account
'AuthBook',
# orgs
2022-11-11 07:11:10 +00:00
"Organization",
# settings
2022-11-11 07:11:10 +00:00
"Setting",
# perms
2022-12-05 07:03:21 +00:00
'AssetPermission',
# notifications
'SystemMsgSubscription', 'UserMsgSubscription',
# Terminal
'Terminal', 'Endpoint', 'EndpointRule', 'CommandStorage', 'ReplayStorage',
# rbac
'Role', 'SystemRole', 'OrgRole', 'RoleBinding', 'OrgRoleBinding', 'SystemRoleBinding',
# xpack
2022-12-05 07:03:21 +00:00
'License', 'Account', 'SyncInstanceTask', 'ChangeAuthPlan',
'GatherUserTask', 'Interface',
)
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")