mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-12-15 08:32:48 +00:00
Compare commits
130 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11d67c6d0e | ||
|
|
627eb6abb1 | ||
|
|
c908b47ccf | ||
|
|
88af33b7c2 | ||
|
|
136537fcfb | ||
|
|
dfd404c549 | ||
|
|
53886a5abf | ||
|
|
50d3125fec | ||
|
|
1145305f11 | ||
|
|
433f063142 | ||
|
|
8c4e496391 | ||
|
|
fad214ccbb | ||
|
|
3b0f68c4c7 | ||
|
|
87b4ecfb3a | ||
|
|
32f2be2793 | ||
|
|
a098bc6c06 | ||
|
|
86870ad985 | ||
|
|
c602bf7224 | ||
|
|
86dab4fc6e | ||
|
|
a85a80a945 | ||
|
|
349edc10aa | ||
|
|
44918e3cb5 | ||
|
|
9a2f6c0d70 | ||
|
|
934969a8f1 | ||
|
|
57162c1628 | ||
|
|
32fb36867f | ||
|
|
158b589028 | ||
|
|
d64277353c | ||
|
|
bff6f397ce | ||
|
|
0ad461a804 | ||
|
|
a1dcef0ba0 | ||
|
|
dbb1ee3a75 | ||
|
|
d6bd207a17 | ||
|
|
e69ba27ff4 | ||
|
|
adbe7c07c6 | ||
|
|
d1eacf53d4 | ||
|
|
19276e6bd4 | ||
|
|
8757cc97ed | ||
|
|
aac805f5e4 | ||
|
|
6febc104de | ||
|
|
733b95ee99 | ||
|
|
b179264127 | ||
|
|
c18388e27a | ||
|
|
52830db500 | ||
|
|
2324cdc14e | ||
|
|
bab4562820 | ||
|
|
613a7d63b5 | ||
|
|
129c0e1bf4 | ||
|
|
384873b4cb | ||
|
|
9e410bb389 | ||
|
|
9337463471 | ||
|
|
e6d50cc8b4 | ||
|
|
fa08517bea | ||
|
|
d808256e6a | ||
|
|
061b60ef59 | ||
|
|
c008115888 | ||
|
|
8d1fb84aaf | ||
|
|
43d61b5348 | ||
|
|
c26a786287 | ||
|
|
cb2bd0cf2c | ||
|
|
3048e6311b | ||
|
|
31de9375e7 | ||
|
|
188c04c9a6 | ||
|
|
a82ed3e924 | ||
|
|
831b67eae4 | ||
|
|
4642804077 | ||
|
|
09160fed5d | ||
|
|
8409523fee | ||
|
|
f52a0ce960 | ||
|
|
d34c4fb7ec | ||
|
|
c12efffcc9 | ||
|
|
6319be0ea3 | ||
|
|
4d7f8ffc71 | ||
|
|
c665b0dbae | ||
|
|
a770a19252 | ||
|
|
717f97cd88 | ||
|
|
d3355ab0ec | ||
|
|
7ac385d64c | ||
|
|
2898c35970 | ||
|
|
62f5662bd0 | ||
|
|
0fe221019a | ||
|
|
d745314aa1 | ||
|
|
153fad9ac7 | ||
|
|
0792c7ec49 | ||
|
|
e617697553 | ||
|
|
9dc7da3595 | ||
|
|
f7f4d3a42e | ||
|
|
70fcbfe883 | ||
|
|
68aad56bad | ||
|
|
85b2ec2e6a | ||
|
|
be75edcb41 | ||
|
|
c41fc54380 | ||
|
|
c2fbe5c75a | ||
|
|
33090c4cdf | ||
|
|
b5ac5c5670 | ||
|
|
d672122c79 | ||
|
|
514fa9cf0a | ||
|
|
7f52675bd3 | ||
|
|
a4be0ff2f3 | ||
|
|
e83d676712 | ||
|
|
015ff4b119 | ||
|
|
c04ab1aab9 | ||
|
|
714b6b1233 | ||
|
|
6f49d240af | ||
|
|
afcbe60531 | ||
|
|
f98c170b8c | ||
|
|
21c41a6334 | ||
|
|
005dd27701 | ||
|
|
8080d36d90 | ||
|
|
91a34d1a88 | ||
|
|
166745baf6 | ||
|
|
c77f02b295 | ||
|
|
cfed849175 | ||
|
|
5996cedcd6 | ||
|
|
a64ec8a1d2 | ||
|
|
45331dc9e8 | ||
|
|
18c388f3a5 | ||
|
|
7be76feeb0 | ||
|
|
ff6dbe67a6 | ||
|
|
c10436de47 | ||
|
|
37a3566b0e | ||
|
|
2b364c1476 | ||
|
|
2036037675 | ||
|
|
6bd597eadd | ||
|
|
fbd0b44d4f | ||
|
|
35722a8466 | ||
|
|
d27947919b | ||
|
|
151d897746 | ||
|
|
d6aad41d05 | ||
|
|
5f7fa7e02f |
@@ -6,7 +6,7 @@ from rest_framework.response import Response
|
|||||||
from accounts import serializers
|
from accounts import serializers
|
||||||
from accounts.filters import AccountFilterSet
|
from accounts.filters import AccountFilterSet
|
||||||
from accounts.models import Account
|
from accounts.models import Account
|
||||||
from assets.models import Asset
|
from assets.models import Asset, Node
|
||||||
from common.permissions import UserConfirmation, ConfirmType
|
from common.permissions import UserConfirmation, ConfirmType
|
||||||
from common.views.mixins import RecordViewLogMixin
|
from common.views.mixins import RecordViewLogMixin
|
||||||
from orgs.mixins.api import OrgBulkModelViewSet
|
from orgs.mixins.api import OrgBulkModelViewSet
|
||||||
@@ -28,6 +28,7 @@ class AccountViewSet(OrgBulkModelViewSet):
|
|||||||
rbac_perms = {
|
rbac_perms = {
|
||||||
'partial_update': ['accounts.change_account'],
|
'partial_update': ['accounts.change_account'],
|
||||||
'su_from_accounts': 'accounts.view_account',
|
'su_from_accounts': 'accounts.view_account',
|
||||||
|
'username_suggestions': 'accounts.view_account',
|
||||||
}
|
}
|
||||||
|
|
||||||
@action(methods=['get'], detail=False, url_path='su-from-accounts')
|
@action(methods=['get'], detail=False, url_path='su-from-accounts')
|
||||||
@@ -42,11 +43,34 @@ class AccountViewSet(OrgBulkModelViewSet):
|
|||||||
asset = get_object_or_404(Asset, pk=asset_id)
|
asset = get_object_or_404(Asset, pk=asset_id)
|
||||||
accounts = asset.accounts.all()
|
accounts = asset.accounts.all()
|
||||||
else:
|
else:
|
||||||
accounts = []
|
accounts = Account.objects.none()
|
||||||
accounts = self.filter_queryset(accounts)
|
accounts = self.filter_queryset(accounts)
|
||||||
serializer = serializers.AccountSerializer(accounts, many=True)
|
serializer = serializers.AccountSerializer(accounts, many=True)
|
||||||
return Response(data=serializer.data)
|
return Response(data=serializer.data)
|
||||||
|
|
||||||
|
@action(methods=['get'], detail=False, url_path='username-suggestions')
|
||||||
|
def username_suggestions(self, request, *args, **kwargs):
|
||||||
|
asset_ids = request.query_params.get('assets')
|
||||||
|
node_keys = request.query_params.get('keys')
|
||||||
|
username = request.query_params.get('username')
|
||||||
|
|
||||||
|
assets = Asset.objects.all()
|
||||||
|
if asset_ids:
|
||||||
|
assets = assets.filter(id__in=asset_ids.split(','))
|
||||||
|
if node_keys:
|
||||||
|
patten = Node.get_node_all_children_key_pattern(node_keys.split(','))
|
||||||
|
assets = assets.filter(nodes__key__regex=patten)
|
||||||
|
|
||||||
|
accounts = Account.objects.filter(asset__in=assets)
|
||||||
|
if username:
|
||||||
|
accounts = accounts.filter(username__icontains=username)
|
||||||
|
usernames = list(accounts.values_list('username', flat=True).distinct()[:10])
|
||||||
|
usernames.sort()
|
||||||
|
common = [i for i in usernames if i in usernames if i.lower() in ['root', 'admin', 'administrator']]
|
||||||
|
others = [i for i in usernames if i not in common]
|
||||||
|
usernames = common + others
|
||||||
|
return Response(data=usernames)
|
||||||
|
|
||||||
|
|
||||||
class AccountSecretsViewSet(RecordViewLogMixin, AccountViewSet):
|
class AccountSecretsViewSet(RecordViewLogMixin, AccountViewSet):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ class ChangeSecretManager(AccountBasePlaybookManager):
|
|||||||
serializer = serializer_cls(recorders, many=True)
|
serializer = serializer_cls(recorders, many=True)
|
||||||
|
|
||||||
header = [str(v.label) for v in serializer.child.fields.values()]
|
header = [str(v.label) for v in serializer.child.fields.values()]
|
||||||
rows = [list(row.values()) for row in serializer.data]
|
rows = [[str(i) for i in row.values()] for row in serializer.data]
|
||||||
if not rows:
|
if not rows:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ from django.db import models
|
|||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from accounts.const import AutomationTypes
|
from accounts.const import AutomationTypes
|
||||||
|
from jumpserver.utils import has_valid_xpack_license
|
||||||
from .base import AccountBaseAutomation
|
from .base import AccountBaseAutomation
|
||||||
from .change_secret import ChangeSecretMixin
|
from .change_secret import ChangeSecretMixin
|
||||||
|
|
||||||
@@ -27,6 +28,8 @@ class PushAccountAutomation(ChangeSecretMixin, AccountBaseAutomation):
|
|||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
self.type = AutomationTypes.push_account
|
self.type = AutomationTypes.push_account
|
||||||
|
if not has_valid_xpack_license():
|
||||||
|
self.is_periodic = False
|
||||||
super().save(*args, **kwargs)
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
def to_attr_json(self):
|
def to_attr_json(self):
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from orgs.utils import tmp_to_org, tmp_to_root_org
|
|||||||
logger = get_logger(__file__)
|
logger = get_logger(__file__)
|
||||||
|
|
||||||
|
|
||||||
def task_activity_callback(self, pid, trigger, tp):
|
def task_activity_callback(self, pid, trigger, tp, *args, **kwargs):
|
||||||
model = AutomationTypes.get_type_model(tp)
|
model = AutomationTypes.get_type_model(tp)
|
||||||
with tmp_to_root_org():
|
with tmp_to_root_org():
|
||||||
instance = get_object_or_none(model, pk=pid)
|
instance = get_object_or_none(model, pk=pid)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from orgs.utils import tmp_to_org, tmp_to_root_org
|
|||||||
logger = get_logger(__file__)
|
logger = get_logger(__file__)
|
||||||
|
|
||||||
|
|
||||||
def task_activity_callback(self, pid, trigger):
|
def task_activity_callback(self, pid, trigger, *args, **kwargs):
|
||||||
from accounts.models import AccountBackupAutomation
|
from accounts.models import AccountBackupAutomation
|
||||||
with tmp_to_root_org():
|
with tmp_to_root_org():
|
||||||
plan = get_object_or_none(AccountBackupAutomation, pk=pid)
|
plan = get_object_or_none(AccountBackupAutomation, pk=pid)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ def gather_asset_accounts_util(nodes, task_name):
|
|||||||
|
|
||||||
@shared_task(
|
@shared_task(
|
||||||
queue="ansible", verbose_name=_('Gather asset accounts'),
|
queue="ansible", verbose_name=_('Gather asset accounts'),
|
||||||
activity_callback=lambda self, node_ids, task_name=None: (node_ids, None)
|
activity_callback=lambda self, node_ids, task_name=None, *args, **kwargs: (node_ids, None)
|
||||||
)
|
)
|
||||||
def gather_asset_accounts_task(node_ids, task_name=None):
|
def gather_asset_accounts_task(node_ids, task_name=None):
|
||||||
if task_name is None:
|
if task_name is None:
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ __all__ = [
|
|||||||
|
|
||||||
@shared_task(
|
@shared_task(
|
||||||
queue="ansible", verbose_name=_('Push accounts to assets'),
|
queue="ansible", verbose_name=_('Push accounts to assets'),
|
||||||
activity_callback=lambda self, account_ids, asset_ids: (account_ids, None)
|
activity_callback=lambda self, account_ids, *args, **kwargs: (account_ids, None)
|
||||||
)
|
)
|
||||||
def push_accounts_to_assets_task(account_ids):
|
def push_accounts_to_assets_task(account_ids):
|
||||||
from accounts.models import PushAccountAutomation
|
from accounts.models import PushAccountAutomation
|
||||||
|
|||||||
@@ -99,13 +99,14 @@ class AssetViewSet(SuggestionMixin, NodeFilterMixin, OrgBulkModelViewSet):
|
|||||||
("platform", serializers.PlatformSerializer),
|
("platform", serializers.PlatformSerializer),
|
||||||
("suggestion", serializers.MiniAssetSerializer),
|
("suggestion", serializers.MiniAssetSerializer),
|
||||||
("gateways", serializers.GatewaySerializer),
|
("gateways", serializers.GatewaySerializer),
|
||||||
("spec_info", serializers.SpecSerializer)
|
("spec_info", serializers.SpecSerializer),
|
||||||
)
|
)
|
||||||
rbac_perms = (
|
rbac_perms = (
|
||||||
("match", "assets.match_asset"),
|
("match", "assets.match_asset"),
|
||||||
("platform", "assets.view_platform"),
|
("platform", "assets.view_platform"),
|
||||||
("gateways", "assets.view_gateway"),
|
("gateways", "assets.view_gateway"),
|
||||||
("spec_info", "assets.view_asset"),
|
("spec_info", "assets.view_asset"),
|
||||||
|
("info", "assets.view_asset"),
|
||||||
)
|
)
|
||||||
extra_filter_backends = [LabelFilterBackend, IpInFilterBackend, NodeFilterBackend]
|
extra_filter_backends = [LabelFilterBackend, IpInFilterBackend, NodeFilterBackend]
|
||||||
|
|
||||||
|
|||||||
@@ -21,4 +21,10 @@ class HostViewSet(AssetViewSet):
|
|||||||
@action(methods=["GET"], detail=True, url_path="info")
|
@action(methods=["GET"], detail=True, url_path="info")
|
||||||
def info(self, *args, **kwargs):
|
def info(self, *args, **kwargs):
|
||||||
asset = super().get_object()
|
asset = super().get_object()
|
||||||
return Response(asset.info)
|
serializer = self.get_serializer(asset.info)
|
||||||
|
data = serializer.data
|
||||||
|
data['asset'] = {
|
||||||
|
'id': asset.id, 'name': asset.name,
|
||||||
|
'address': asset.address
|
||||||
|
}
|
||||||
|
return Response(data)
|
||||||
|
|||||||
@@ -214,10 +214,13 @@ class AllTypes(ChoicesMixin):
|
|||||||
tp_node = cls.choice_to_node(tp, category_node['id'], opened=False, meta=meta)
|
tp_node = cls.choice_to_node(tp, category_node['id'], opened=False, meta=meta)
|
||||||
tp_count = category_type_mapper.get(category + '_' + tp, 0)
|
tp_count = category_type_mapper.get(category + '_' + tp, 0)
|
||||||
tp_node['name'] += f'({tp_count})'
|
tp_node['name'] += f'({tp_count})'
|
||||||
|
platforms = tp_platforms.get(category + '_' + tp, [])
|
||||||
|
if not platforms:
|
||||||
|
tp_node['isParent'] = False
|
||||||
nodes.append(tp_node)
|
nodes.append(tp_node)
|
||||||
|
|
||||||
# Platform 格式化
|
# Platform 格式化
|
||||||
for p in tp_platforms.get(category + '_' + tp, []):
|
for p in platforms:
|
||||||
platform_node = cls.platform_to_node(p, tp_node['id'], include_asset)
|
platform_node = cls.platform_to_node(p, tp_node['id'], include_asset)
|
||||||
platform_node['name'] += f'({platform_count.get(p.id, 0)})'
|
platform_node['name'] += f'({platform_count.get(p.id, 0)})'
|
||||||
nodes.append(platform_node)
|
nodes.append(platform_node)
|
||||||
@@ -306,10 +309,11 @@ class AllTypes(ChoicesMixin):
|
|||||||
protocols_data = deepcopy(default_protocols)
|
protocols_data = deepcopy(default_protocols)
|
||||||
if _protocols:
|
if _protocols:
|
||||||
protocols_data = [p for p in protocols_data if p['name'] in _protocols]
|
protocols_data = [p for p in protocols_data if p['name'] in _protocols]
|
||||||
|
|
||||||
for p in protocols_data:
|
for p in protocols_data:
|
||||||
setting = _protocols_setting.get(p['name'], {})
|
setting = _protocols_setting.get(p['name'], {})
|
||||||
p['required'] = p.pop('required', False)
|
p['required'] = setting.pop('required', False)
|
||||||
p['default'] = p.pop('default', False)
|
p['default'] = setting.pop('default', False)
|
||||||
p['setting'] = {**p.get('setting', {}), **setting}
|
p['setting'] = {**p.get('setting', {}), **setting}
|
||||||
|
|
||||||
platform_data = {
|
platform_data = {
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='asset',
|
model_name='asset',
|
||||||
name='address',
|
name='address',
|
||||||
field=models.CharField(db_index=True, max_length=1024, verbose_name='Address'),
|
field=models.CharField(db_index=True, max_length=767, verbose_name='Address'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='asset',
|
model_name='asset',
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
# Generated by Django 3.2.12 on 2022-07-11 06:13
|
# Generated by Django 3.2.12 on 2022-07-11 06:13
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
from django.utils import timezone
|
||||||
|
from itertools import groupby
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
def migrate_asset_accounts(apps, schema_editor):
|
def migrate_asset_accounts(apps, schema_editor):
|
||||||
auth_book_model = apps.get_model('assets', 'AuthBook')
|
auth_book_model = apps.get_model('assets', 'AuthBook')
|
||||||
account_model = apps.get_model('accounts', 'Account')
|
account_model = apps.get_model('accounts', 'Account')
|
||||||
|
account_history_model = apps.get_model('accounts', 'HistoricalAccount')
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
bulk_size = 1000
|
bulk_size = 1000
|
||||||
@@ -20,34 +23,35 @@ def migrate_asset_accounts(apps, schema_editor):
|
|||||||
break
|
break
|
||||||
|
|
||||||
count += len(auth_books)
|
count += len(auth_books)
|
||||||
accounts = []
|
|
||||||
# auth book 和 account 相同的属性
|
# auth book 和 account 相同的属性
|
||||||
same_attrs = [
|
same_attrs = [
|
||||||
'id', 'username', 'comment', 'date_created', 'date_updated',
|
'id', 'username', 'comment', 'date_created', 'date_updated',
|
||||||
'created_by', 'asset_id', 'org_id',
|
'created_by', 'asset_id', 'org_id',
|
||||||
]
|
]
|
||||||
# 认证的属性,可能是 authbook 的,可能是 systemuser 的
|
# 认证的属性,可能是 auth_book 的,可能是 system_user 的
|
||||||
auth_attrs = ['password', 'private_key', 'token']
|
auth_attrs = ['password', 'private_key', 'token']
|
||||||
all_attrs = same_attrs + auth_attrs
|
all_attrs = same_attrs + auth_attrs
|
||||||
|
|
||||||
|
accounts = []
|
||||||
for auth_book in auth_books:
|
for auth_book in auth_books:
|
||||||
values = {'version': 1}
|
account_values = {'version': 1}
|
||||||
|
|
||||||
system_user = auth_book.systemuser
|
system_user = auth_book.systemuser
|
||||||
if system_user:
|
if system_user:
|
||||||
# 更新一次系统用户的认证属性
|
# 更新一次系统用户的认证属性
|
||||||
values.update({attr: getattr(system_user, attr, '') for attr in all_attrs})
|
account_values.update({attr: getattr(system_user, attr, '') for attr in all_attrs})
|
||||||
values['created_by'] = str(system_user.id)
|
account_values['created_by'] = str(system_user.id)
|
||||||
values['privileged'] = system_user.type == 'admin'
|
account_values['privileged'] = system_user.type == 'admin' \
|
||||||
|
or system_user.username in ['root', 'Administrator']
|
||||||
|
|
||||||
auth_book_auth = {attr: getattr(auth_book, attr, '') for attr in all_attrs if getattr(auth_book, attr, '')}
|
auth_book_auth = {attr: getattr(auth_book, attr, '') for attr in all_attrs if getattr(auth_book, attr, '')}
|
||||||
# 最终使用 authbook 的认证属性
|
# 最终优先使用 auth_book 的认证属性
|
||||||
values.update(auth_book_auth)
|
account_values.update(auth_book_auth)
|
||||||
|
|
||||||
auth_infos = []
|
auth_infos = []
|
||||||
username = values['username']
|
username = account_values['username']
|
||||||
for attr in auth_attrs:
|
for attr in auth_attrs:
|
||||||
secret = values.pop(attr, None)
|
secret = account_values.pop(attr, None)
|
||||||
if not secret:
|
if not secret:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -66,13 +70,48 @@ def migrate_asset_accounts(apps, schema_editor):
|
|||||||
auth_infos.append((username, 'password', ''))
|
auth_infos.append((username, 'password', ''))
|
||||||
|
|
||||||
for name, secret_type, secret in auth_infos:
|
for name, secret_type, secret in auth_infos:
|
||||||
account = account_model(**values, name=name, secret=secret, secret_type=secret_type)
|
if not name:
|
||||||
|
continue
|
||||||
|
account = account_model(**account_values, name=name, secret=secret, secret_type=secret_type)
|
||||||
accounts.append(account)
|
accounts.append(account)
|
||||||
|
|
||||||
account_model.objects.bulk_create(accounts, ignore_conflicts=True)
|
accounts.sort(key=lambda x: (x.name, x.asset_id, x.date_updated))
|
||||||
|
grouped_accounts = groupby(accounts, lambda x: (x.name, x.asset_id))
|
||||||
|
|
||||||
|
accounts_to_add = []
|
||||||
|
accounts_to_history = []
|
||||||
|
for key, _accounts in grouped_accounts:
|
||||||
|
_accounts = list(_accounts)
|
||||||
|
if not _accounts:
|
||||||
|
continue
|
||||||
|
_account = _accounts[-1]
|
||||||
|
accounts_to_add.append(_account)
|
||||||
|
_account_history = []
|
||||||
|
|
||||||
|
for ac in _accounts:
|
||||||
|
if not ac.secret:
|
||||||
|
continue
|
||||||
|
if ac.id != _account.id and ac.secret == _account.secret:
|
||||||
|
continue
|
||||||
|
history_data = {
|
||||||
|
'id': _account.id,
|
||||||
|
'secret': ac.secret,
|
||||||
|
'secret_type': ac.secret_type,
|
||||||
|
'history_date': ac.date_updated,
|
||||||
|
'history_type': '~',
|
||||||
|
'history_change_reason': 'from account {}'.format(_account.name),
|
||||||
|
}
|
||||||
|
_account_history.append(account_history_model(**history_data))
|
||||||
|
_account.version = len(_account_history)
|
||||||
|
accounts_to_history.extend(_account_history)
|
||||||
|
|
||||||
|
account_model.objects.bulk_create(accounts_to_add, ignore_conflicts=True)
|
||||||
|
account_history_model.objects.bulk_create(accounts_to_history, ignore_conflicts=True)
|
||||||
print("\t - Create asset accounts: {}-{} using: {:.2f}s".format(
|
print("\t - Create asset accounts: {}-{} using: {:.2f}s".format(
|
||||||
count - len(auth_books), count, time.time() - start
|
count - len(auth_books), count, time.time() - start
|
||||||
))
|
))
|
||||||
|
print("\t - accounts: {}".format(len(accounts_to_add)))
|
||||||
|
print("\t - histories: {}".format(len(accounts_to_history)))
|
||||||
|
|
||||||
|
|
||||||
def migrate_db_accounts(apps, schema_editor):
|
def migrate_db_accounts(apps, schema_editor):
|
||||||
@@ -130,6 +169,9 @@ def migrate_db_accounts(apps, schema_editor):
|
|||||||
values['secret_type'] = secret_type
|
values['secret_type'] = secret_type
|
||||||
values['secret'] = secret
|
values['secret'] = secret
|
||||||
|
|
||||||
|
if not name:
|
||||||
|
continue
|
||||||
|
|
||||||
for app in apps:
|
for app in apps:
|
||||||
values['asset_id'] = str(app.id)
|
values['asset_id'] = str(app.id)
|
||||||
account = account_model(**values)
|
account = account_model(**values)
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class Asset(NodesRelationMixin, AbsConnectivity, JMSOrgBaseModel):
|
|||||||
Type = const.AllTypes
|
Type = const.AllTypes
|
||||||
|
|
||||||
name = models.CharField(max_length=128, verbose_name=_('Name'))
|
name = models.CharField(max_length=128, verbose_name=_('Name'))
|
||||||
address = models.CharField(max_length=1024, verbose_name=_('Address'), db_index=True)
|
address = models.CharField(max_length=767, verbose_name=_('Address'), db_index=True)
|
||||||
platform = models.ForeignKey(Platform, on_delete=models.PROTECT, verbose_name=_("Platform"), related_name='assets')
|
platform = models.ForeignKey(Platform, on_delete=models.PROTECT, verbose_name=_("Platform"), related_name='assets')
|
||||||
domain = models.ForeignKey("assets.Domain", null=True, blank=True, related_name='assets',
|
domain = models.ForeignKey("assets.Domain", null=True, blank=True, related_name='assets',
|
||||||
verbose_name=_("Domain"), on_delete=models.SET_NULL)
|
verbose_name=_("Domain"), on_delete=models.SET_NULL)
|
||||||
|
|||||||
@@ -489,7 +489,7 @@ class SomeNodesMixin:
|
|||||||
return cls.default_node()
|
return cls.default_node()
|
||||||
|
|
||||||
if ori_org and ori_org.is_root():
|
if ori_org and ori_org.is_root():
|
||||||
return None
|
return cls.default_node()
|
||||||
|
|
||||||
org_roots = cls.org_root_nodes()
|
org_roots = cls.org_root_nodes()
|
||||||
org_roots_length = len(org_roots)
|
org_roots_length = len(org_roots)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from orgs.utils import tmp_to_root_org, tmp_to_org
|
|||||||
logger = get_logger(__file__)
|
logger = get_logger(__file__)
|
||||||
|
|
||||||
|
|
||||||
def task_activity_callback(self, pid, trigger, tp):
|
def task_activity_callback(self, pid, trigger, tp, *args, **kwargs):
|
||||||
model = AutomationTypes.get_type_model(tp)
|
model = AutomationTypes.get_type_model(tp)
|
||||||
with tmp_to_root_org():
|
with tmp_to_root_org():
|
||||||
instance = get_object_or_none(model, pk=pid)
|
instance = get_object_or_none(model, pk=pid)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ from rest_framework.permissions import IsAuthenticated
|
|||||||
from common.drf.filters import DatetimeRangeFilter
|
from common.drf.filters import DatetimeRangeFilter
|
||||||
from common.plugins.es import QuerySet as ESQuerySet
|
from common.plugins.es import QuerySet as ESQuerySet
|
||||||
from common.utils import is_uuid
|
from common.utils import is_uuid
|
||||||
|
from common.utils import lazyproperty
|
||||||
from orgs.mixins.api import OrgReadonlyModelViewSet, OrgModelViewSet
|
from orgs.mixins.api import OrgReadonlyModelViewSet, OrgModelViewSet
|
||||||
from orgs.utils import current_org, tmp_to_root_org
|
from orgs.utils import current_org, tmp_to_root_org
|
||||||
from orgs.models import Organization
|
from orgs.models import Organization
|
||||||
@@ -143,13 +144,19 @@ class OperateLogViewSet(OrgReadonlyModelViewSet):
|
|||||||
search_fields = ['resource', 'user']
|
search_fields = ['resource', 'user']
|
||||||
ordering = ['-datetime']
|
ordering = ['-datetime']
|
||||||
|
|
||||||
|
@lazyproperty
|
||||||
|
def is_action_detail(self):
|
||||||
|
return self.detail and self.request.query_params.get('type') == 'action_detail'
|
||||||
|
|
||||||
def get_serializer_class(self):
|
def get_serializer_class(self):
|
||||||
if self.request.query_params.get('type') == 'action_detail':
|
if self.is_action_detail:
|
||||||
return OperateLogActionDetailSerializer
|
return OperateLogActionDetailSerializer
|
||||||
return super().get_serializer_class()
|
return super().get_serializer_class()
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
org_q = Q(org_id=Organization.SYSTEM_ID) | Q(org_id=current_org.id)
|
org_q = Q(org_id=current_org.id)
|
||||||
|
if self.is_action_detail:
|
||||||
|
org_q |= Q(org_id=Organization.SYSTEM_ID)
|
||||||
with tmp_to_root_org():
|
with tmp_to_root_org():
|
||||||
qs = OperateLog.objects.filter(org_q)
|
qs = OperateLog.objects.filter(org_q)
|
||||||
es_config = settings.OPERATE_LOG_ELASTICSEARCH_CONFIG
|
es_config = settings.OPERATE_LOG_ELASTICSEARCH_CONFIG
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ from django.db import transaction
|
|||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from users.models import User
|
|
||||||
from common.utils import get_request_ip, get_logger
|
from common.utils import get_request_ip, get_logger
|
||||||
from common.utils.timezone import as_current_tz
|
from common.utils.timezone import as_current_tz
|
||||||
from common.utils.encode import Singleton
|
from common.utils.encode import Singleton
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
from orgs.mixins.serializers import BulkOrgResourceModelSerializer
|
||||||
from audits.backends.db import OperateLogStore
|
from audits.backends.db import OperateLogStore
|
||||||
from common.serializers.fields import LabeledChoiceField
|
from common.serializers.fields import LabeledChoiceField
|
||||||
from common.utils import reverse, i18n_trans
|
from common.utils import reverse, i18n_trans
|
||||||
@@ -78,7 +78,7 @@ class OperateLogActionDetailSerializer(serializers.ModelSerializer):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
class OperateLogSerializer(serializers.ModelSerializer):
|
class OperateLogSerializer(BulkOrgResourceModelSerializer):
|
||||||
action = LabeledChoiceField(choices=ActionChoices.choices, label=_("Action"))
|
action = LabeledChoiceField(choices=ActionChoices.choices, label=_("Action"))
|
||||||
resource = serializers.SerializerMethodField(label=_("Resource"))
|
resource = serializers.SerializerMethodField(label=_("Resource"))
|
||||||
resource_type = serializers.SerializerMethodField(label=_('Resource Type'))
|
resource_type = serializers.SerializerMethodField(label=_('Resource Type'))
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
import codecs
|
import codecs
|
||||||
import copy
|
import copy
|
||||||
import csv
|
import csv
|
||||||
|
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
|
|
||||||
|
from common.utils.timezone import as_current_tz
|
||||||
from common.utils import validate_ip, get_ip_city, get_logger
|
from common.utils import validate_ip, get_ip_city, get_logger
|
||||||
from settings.serializers import SettingsSerializer
|
|
||||||
from .const import DEFAULT_CITY
|
from .const import DEFAULT_CITY
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
@@ -70,6 +72,8 @@ def _get_instance_field_value(
|
|||||||
f.verbose_name = 'id'
|
f.verbose_name = 'id'
|
||||||
elif isinstance(value, (list, dict)):
|
elif isinstance(value, (list, dict)):
|
||||||
value = copy.deepcopy(value)
|
value = copy.deepcopy(value)
|
||||||
|
elif isinstance(value, datetime):
|
||||||
|
value = as_current_tz(value).strftime('%Y-%m-%d %H:%M:%S')
|
||||||
elif isinstance(f, models.OneToOneField) and isinstance(value, models.Model):
|
elif isinstance(f, models.OneToOneField) and isinstance(value, models.Model):
|
||||||
nested_data = _get_instance_field_value(
|
nested_data = _get_instance_field_value(
|
||||||
value, include_model_fields, model_need_continue_fields, ('id',)
|
value, include_model_fields, model_need_continue_fields, ('id',)
|
||||||
|
|||||||
@@ -225,6 +225,7 @@ class MFAMixin:
|
|||||||
self.request.session['auth_mfa_time'] = time.time()
|
self.request.session['auth_mfa_time'] = time.time()
|
||||||
self.request.session['auth_mfa_required'] = 0
|
self.request.session['auth_mfa_required'] = 0
|
||||||
self.request.session['auth_mfa_type'] = mfa_type
|
self.request.session['auth_mfa_type'] = mfa_type
|
||||||
|
MFABlockUtils(self.request.user.username, self.get_request_ip()).clean_failed_count()
|
||||||
|
|
||||||
def clean_mfa_mark(self):
|
def clean_mfa_mark(self):
|
||||||
keys = ['auth_mfa', 'auth_mfa_time', 'auth_mfa_required', 'auth_mfa_type']
|
keys = ['auth_mfa', 'auth_mfa_time', 'auth_mfa_required', 'auth_mfa_type']
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import os
|
|||||||
import datetime
|
import datetime
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
|
from django.db import IntegrityError
|
||||||
from django.templatetags.static import static
|
from django.templatetags.static import static
|
||||||
from django.contrib.auth import login as auth_login, logout as auth_logout
|
from django.contrib.auth import login as auth_login, logout as auth_logout
|
||||||
from django.http import HttpResponse, HttpRequest
|
from django.http import HttpResponse, HttpRequest
|
||||||
@@ -229,6 +230,23 @@ class UserLoginView(mixins.AuthMixin, UserLoginContextMixin, FormView):
|
|||||||
) as e:
|
) as e:
|
||||||
form.add_error('code', e.msg)
|
form.add_error('code', e.msg)
|
||||||
return super().form_invalid(form)
|
return super().form_invalid(form)
|
||||||
|
except (IntegrityError,) as e:
|
||||||
|
# (1062, "Duplicate entry 'youtester001@example.com' for key 'users_user.email'")
|
||||||
|
error = str(e)
|
||||||
|
if len(e.args) < 2:
|
||||||
|
form.add_error(None, error)
|
||||||
|
return super().form_invalid(form)
|
||||||
|
|
||||||
|
msg_list = e.args[1].split("'")
|
||||||
|
if len(msg_list) < 4:
|
||||||
|
form.add_error(None, error)
|
||||||
|
return super().form_invalid(form)
|
||||||
|
|
||||||
|
email, field = msg_list[1], msg_list[3]
|
||||||
|
if field == 'users_user.email':
|
||||||
|
error = _('User email already exists ({})').format(email)
|
||||||
|
form.add_error(None, error)
|
||||||
|
return super().form_invalid(form)
|
||||||
self.clear_rsa_key()
|
self.clear_rsa_key()
|
||||||
return self.redirect_to_guard_view()
|
return self.redirect_to_guard_view()
|
||||||
|
|
||||||
|
|||||||
@@ -32,11 +32,14 @@ class UserLoginMFAView(mixins.AuthMixin, FormView):
|
|||||||
return super().get(*args, **kwargs)
|
return super().get(*args, **kwargs)
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
|
from users.utils import MFABlockUtils
|
||||||
code = form.cleaned_data.get('code')
|
code = form.cleaned_data.get('code')
|
||||||
mfa_type = form.cleaned_data.get('mfa_type')
|
mfa_type = form.cleaned_data.get('mfa_type')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._do_check_user_mfa(code, mfa_type)
|
self._do_check_user_mfa(code, mfa_type)
|
||||||
|
user, ip = self.get_user_from_session(), self.get_request_ip()
|
||||||
|
MFABlockUtils(user.username, ip).clean_failed_count()
|
||||||
return redirect_to_guard_view('mfa_ok')
|
return redirect_to_guard_view('mfa_ok')
|
||||||
except (errors.MFAFailedError, errors.BlockMFAError) as e:
|
except (errors.MFAFailedError, errors.BlockMFAError) as e:
|
||||||
form.add_error('code', e.msg)
|
form.add_error('code', e.msg)
|
||||||
|
|||||||
@@ -2,4 +2,3 @@ from __future__ import absolute_import
|
|||||||
|
|
||||||
# This will make sure the app is always imported when
|
# This will make sure the app is always imported when
|
||||||
# Django starts so that shared_task will use this app.
|
# Django starts so that shared_task will use this app.
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from werkzeug.local import Local
|
from werkzeug.local import Local
|
||||||
|
|
||||||
thread_local = Local()
|
thread_local = Local()
|
||||||
encrypted_field_set = set()
|
encrypted_field_set = {'password'}
|
||||||
|
|
||||||
|
|
||||||
def _find(attr):
|
def _find(attr):
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from .utils import get_logger
|
|||||||
logger = get_logger(__file__)
|
logger = get_logger(__file__)
|
||||||
|
|
||||||
|
|
||||||
def task_activity_callback(self, subject, message, recipient_list, **kwargs):
|
def task_activity_callback(self, subject, message, recipient_list, *args, **kwargs):
|
||||||
from users.models import User
|
from users.models import User
|
||||||
email_list = recipient_list
|
email_list = recipient_list
|
||||||
resource_ids = list(User.objects.filter(email__in=email_list).values_list('id', flat=True))
|
resource_ids = list(User.objects.filter(email__in=email_list).values_list('id', flat=True))
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class Subscription:
|
|||||||
try:
|
try:
|
||||||
self.sub.close()
|
self.sub.close()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error('Unsubscribe msg error: {}'.format(e))
|
logger.debug('Unsubscribe msg error: {}'.format(e))
|
||||||
|
|
||||||
def retry(self, _next, error, complete):
|
def retry(self, _next, error, complete):
|
||||||
logger.info('Retry subscribe channel: {}'.format(self.ch))
|
logger.info('Retry subscribe channel: {}'.format(self.ch))
|
||||||
|
|||||||
@@ -35,7 +35,10 @@ def i18n_trans(s):
|
|||||||
tpl, args = s.split(' % ', 1)
|
tpl, args = s.split(' % ', 1)
|
||||||
args = args.split(', ')
|
args = args.split(', ')
|
||||||
args = [gettext(arg) for arg in args]
|
args = [gettext(arg) for arg in args]
|
||||||
return gettext(tpl) % tuple(args)
|
try:
|
||||||
|
return gettext(tpl) % tuple(args)
|
||||||
|
except TypeError:
|
||||||
|
return gettext(tpl)
|
||||||
|
|
||||||
|
|
||||||
def hello():
|
def hello():
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2023-02-23 19:11+0800\n"
|
"POT-Creation-Date: 2023-03-02 16:00+0800\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@@ -394,7 +394,7 @@ msgid "Date last login"
|
|||||||
msgstr "最終ログイン日"
|
msgstr "最終ログイン日"
|
||||||
|
|
||||||
#: accounts/models/automations/gather_account.py:15
|
#: accounts/models/automations/gather_account.py:15
|
||||||
#: accounts/models/automations/push_account.py:13 accounts/models/base.py:34
|
#: accounts/models/automations/push_account.py:14 accounts/models/base.py:34
|
||||||
#: acls/serializers/base.py:18 acls/serializers/base.py:49
|
#: acls/serializers/base.py:18 acls/serializers/base.py:49
|
||||||
#: assets/models/_user.py:23 audits/models.py:157 authentication/forms.py:25
|
#: assets/models/_user.py:23 audits/models.py:157 authentication/forms.py:25
|
||||||
#: authentication/forms.py:27 authentication/models/temp_token.py:9
|
#: authentication/forms.py:27 authentication/models/temp_token.py:9
|
||||||
@@ -419,11 +419,11 @@ msgstr "自動収集アカウント"
|
|||||||
msgid "Gather asset accounts"
|
msgid "Gather asset accounts"
|
||||||
msgstr "アカウントのコレクション"
|
msgstr "アカウントのコレクション"
|
||||||
|
|
||||||
#: accounts/models/automations/push_account.py:12
|
#: accounts/models/automations/push_account.py:13
|
||||||
msgid "Triggers"
|
msgid "Triggers"
|
||||||
msgstr "トリガー方式"
|
msgstr "トリガー方式"
|
||||||
|
|
||||||
#: accounts/models/automations/push_account.py:14 acls/models/base.py:81
|
#: accounts/models/automations/push_account.py:15 acls/models/base.py:81
|
||||||
#: acls/serializers/base.py:81 acls/serializers/login_acl.py:25
|
#: acls/serializers/base.py:81 acls/serializers/login_acl.py:25
|
||||||
#: assets/models/cmd_filter.py:81 audits/models.py:65 audits/serializers.py:82
|
#: assets/models/cmd_filter.py:81 audits/models.py:65 audits/serializers.py:82
|
||||||
#: authentication/serializers/connect_token_secret.py:109
|
#: authentication/serializers/connect_token_secret.py:109
|
||||||
@@ -431,7 +431,7 @@ msgstr "トリガー方式"
|
|||||||
msgid "Action"
|
msgid "Action"
|
||||||
msgstr "アクション"
|
msgstr "アクション"
|
||||||
|
|
||||||
#: accounts/models/automations/push_account.py:40
|
#: accounts/models/automations/push_account.py:43
|
||||||
msgid "Push asset account"
|
msgid "Push asset account"
|
||||||
msgstr "アカウントプッシュ"
|
msgstr "アカウントプッシュ"
|
||||||
|
|
||||||
@@ -447,7 +447,7 @@ msgstr "アカウントの確認"
|
|||||||
#: assets/models/group.py:20 assets/models/label.py:18
|
#: assets/models/group.py:20 assets/models/label.py:18
|
||||||
#: assets/models/platform.py:21 assets/models/platform.py:76
|
#: assets/models/platform.py:21 assets/models/platform.py:76
|
||||||
#: assets/serializers/asset/common.py:67 assets/serializers/asset/common.py:143
|
#: assets/serializers/asset/common.py:67 assets/serializers/asset/common.py:143
|
||||||
#: assets/serializers/platform.py:91 assets/serializers/platform.py:136
|
#: assets/serializers/platform.py:133
|
||||||
#: authentication/serializers/connect_token_secret.py:103 ops/mixin.py:21
|
#: authentication/serializers/connect_token_secret.py:103 ops/mixin.py:21
|
||||||
#: ops/models/adhoc.py:21 ops/models/celery.py:15 ops/models/celery.py:57
|
#: ops/models/adhoc.py:21 ops/models/celery.py:15 ops/models/celery.py:57
|
||||||
#: ops/models/job.py:91 ops/models/playbook.py:23 ops/serializers/job.py:19
|
#: ops/models/job.py:91 ops/models/playbook.py:23 ops/serializers/job.py:19
|
||||||
@@ -533,7 +533,7 @@ msgstr "エスクローされたパスワード"
|
|||||||
#: accounts/serializers/account/account.py:75 applications/models.py:11
|
#: accounts/serializers/account/account.py:75 applications/models.py:11
|
||||||
#: assets/models/label.py:21 assets/models/platform.py:77
|
#: assets/models/label.py:21 assets/models/platform.py:77
|
||||||
#: assets/serializers/asset/common.py:120 assets/serializers/cagegory.py:8
|
#: assets/serializers/asset/common.py:120 assets/serializers/cagegory.py:8
|
||||||
#: assets/serializers/platform.py:97 assets/serializers/platform.py:137
|
#: assets/serializers/platform.py:94 assets/serializers/platform.py:134
|
||||||
#: perms/serializers/user_permission.py:26 settings/models.py:35
|
#: perms/serializers/user_permission.py:26 settings/models.py:35
|
||||||
#: tickets/models/ticket/apply_application.py:13
|
#: tickets/models/ticket/apply_application.py:13
|
||||||
msgid "Category"
|
msgid "Category"
|
||||||
@@ -544,7 +544,7 @@ msgstr "カテゴリ"
|
|||||||
#: acls/serializers/command_acl.py:18 applications/models.py:14
|
#: acls/serializers/command_acl.py:18 applications/models.py:14
|
||||||
#: assets/models/_user.py:50 assets/models/automations/base.py:20
|
#: assets/models/_user.py:50 assets/models/automations/base.py:20
|
||||||
#: assets/models/cmd_filter.py:74 assets/models/platform.py:78
|
#: assets/models/cmd_filter.py:74 assets/models/platform.py:78
|
||||||
#: assets/serializers/asset/common.py:121 assets/serializers/platform.py:96
|
#: assets/serializers/asset/common.py:121 assets/serializers/platform.py:93
|
||||||
#: audits/serializers.py:48
|
#: audits/serializers.py:48
|
||||||
#: authentication/serializers/connect_token_secret.py:116 ops/models/job.py:102
|
#: authentication/serializers/connect_token_secret.py:116 ops/models/job.py:102
|
||||||
#: perms/serializers/user_permission.py:27 terminal/models/applet/applet.py:31
|
#: perms/serializers/user_permission.py:27 terminal/models/applet/applet.py:31
|
||||||
@@ -741,7 +741,7 @@ msgstr "アクティブ"
|
|||||||
#: authentication/models/sso_token.py:16
|
#: authentication/models/sso_token.py:16
|
||||||
#: notifications/models/notification.py:12
|
#: notifications/models/notification.py:12
|
||||||
#: perms/api/user_permission/mixin.py:55 perms/models/asset_permission.py:58
|
#: perms/api/user_permission/mixin.py:55 perms/models/asset_permission.py:58
|
||||||
#: perms/serializers/permission.py:23 rbac/builtin.py:118
|
#: perms/serializers/permission.py:23 rbac/builtin.py:122
|
||||||
#: rbac/models/rolebinding.py:49 terminal/backends/command/models.py:19
|
#: rbac/models/rolebinding.py:49 terminal/backends/command/models.py:19
|
||||||
#: terminal/models/session/session.py:30 terminal/models/session/sharing.py:32
|
#: terminal/models/session/session.py:30 terminal/models/session/sharing.py:32
|
||||||
#: terminal/notifications.py:96 terminal/notifications.py:144
|
#: terminal/notifications.py:96 terminal/notifications.py:144
|
||||||
@@ -908,7 +908,7 @@ msgstr "アプリケーション"
|
|||||||
msgid "Can match application"
|
msgid "Can match application"
|
||||||
msgstr "アプリケーションを一致させることができます"
|
msgstr "アプリケーションを一致させることができます"
|
||||||
|
|
||||||
#: assets/api/asset/asset.py:142
|
#: assets/api/asset/asset.py:143
|
||||||
msgid "Cannot create asset directly, you should create a host or other"
|
msgid "Cannot create asset directly, you should create a host or other"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"資産を直接作成することはできません。ホストまたはその他を作成する必要がありま"
|
"資産を直接作成することはできません。ホストまたはその他を作成する必要がありま"
|
||||||
@@ -944,10 +944,8 @@ msgid "No account"
|
|||||||
msgstr "アカウントなし"
|
msgstr "アカウントなし"
|
||||||
|
|
||||||
#: assets/automations/ping_gateway/manager.py:36
|
#: assets/automations/ping_gateway/manager.py:36
|
||||||
#, fuzzy
|
|
||||||
#| msgid "Assets amount"
|
|
||||||
msgid "Asset, {}, using account {}"
|
msgid "Asset, {}, using account {}"
|
||||||
msgstr "資産額"
|
msgstr "資産, {}, アカウントを使用 {}"
|
||||||
|
|
||||||
#: assets/automations/ping_gateway/manager.py:55
|
#: assets/automations/ping_gateway/manager.py:55
|
||||||
#, python-brace-format
|
#, python-brace-format
|
||||||
@@ -1459,23 +1457,23 @@ msgstr "メタ"
|
|||||||
msgid "Internal"
|
msgid "Internal"
|
||||||
msgstr "ビルトイン"
|
msgstr "ビルトイン"
|
||||||
|
|
||||||
#: assets/models/platform.py:83 assets/serializers/platform.py:94
|
#: assets/models/platform.py:83 assets/serializers/platform.py:91
|
||||||
msgid "Charset"
|
msgid "Charset"
|
||||||
msgstr "シャーセット"
|
msgstr "シャーセット"
|
||||||
|
|
||||||
#: assets/models/platform.py:85 assets/serializers/platform.py:122
|
#: assets/models/platform.py:85 assets/serializers/platform.py:119
|
||||||
msgid "Domain enabled"
|
msgid "Domain enabled"
|
||||||
msgstr "ドメインを有効にする"
|
msgstr "ドメインを有効にする"
|
||||||
|
|
||||||
#: assets/models/platform.py:87 assets/serializers/platform.py:121
|
#: assets/models/platform.py:87 assets/serializers/platform.py:118
|
||||||
msgid "Su enabled"
|
msgid "Su enabled"
|
||||||
msgstr "アカウントの切り替えを有効にする"
|
msgstr "アカウントの切り替えを有効にする"
|
||||||
|
|
||||||
#: assets/models/platform.py:88 assets/serializers/platform.py:104
|
#: assets/models/platform.py:88 assets/serializers/platform.py:101
|
||||||
msgid "Su method"
|
msgid "Su method"
|
||||||
msgstr "アカウントの切り替え方法"
|
msgstr "アカウントの切り替え方法"
|
||||||
|
|
||||||
#: assets/models/platform.py:90 assets/serializers/platform.py:101
|
#: assets/models/platform.py:90 assets/serializers/platform.py:98
|
||||||
msgid "Automation"
|
msgid "Automation"
|
||||||
msgstr "オートメーション"
|
msgstr "オートメーション"
|
||||||
|
|
||||||
@@ -1488,7 +1486,7 @@ msgstr "%(value)s は偶数ではありません"
|
|||||||
msgid "Auto fill"
|
msgid "Auto fill"
|
||||||
msgstr "自動充填"
|
msgstr "自動充填"
|
||||||
|
|
||||||
#: assets/serializers/asset/common.py:123 assets/serializers/platform.py:99
|
#: assets/serializers/asset/common.py:123 assets/serializers/platform.py:96
|
||||||
#: authentication/serializers/connect_token_secret.py:28
|
#: authentication/serializers/connect_token_secret.py:28
|
||||||
#: authentication/serializers/connect_token_secret.py:66
|
#: authentication/serializers/connect_token_secret.py:66
|
||||||
#: perms/serializers/user_permission.py:25 xpack/plugins/cloud/models.py:99
|
#: perms/serializers/user_permission.py:25 xpack/plugins/cloud/models.py:99
|
||||||
@@ -1629,7 +1627,7 @@ msgstr "アカウントの収集方法"
|
|||||||
msgid "Primary"
|
msgid "Primary"
|
||||||
msgstr "主要"
|
msgstr "主要"
|
||||||
|
|
||||||
#: assets/serializers/platform.py:123
|
#: assets/serializers/platform.py:120
|
||||||
msgid "Default Domain"
|
msgid "Default Domain"
|
||||||
msgstr "デフォルト ドメイン"
|
msgstr "デフォルト ドメイン"
|
||||||
|
|
||||||
@@ -1940,20 +1938,20 @@ msgid "Auth Token"
|
|||||||
msgstr "認証トークン"
|
msgstr "認証トークン"
|
||||||
|
|
||||||
#: audits/signal_handlers/login_log.py:31 authentication/notifications.py:73
|
#: audits/signal_handlers/login_log.py:31 authentication/notifications.py:73
|
||||||
#: authentication/views/login.py:73 authentication/views/wecom.py:177
|
#: authentication/views/login.py:74 authentication/views/wecom.py:177
|
||||||
#: notifications/backends/__init__.py:11 settings/serializers/auth/wecom.py:10
|
#: notifications/backends/__init__.py:11 settings/serializers/auth/wecom.py:10
|
||||||
#: users/models/user.py:778
|
#: users/models/user.py:778
|
||||||
msgid "WeCom"
|
msgid "WeCom"
|
||||||
msgstr "企業微信"
|
msgstr "企業微信"
|
||||||
|
|
||||||
#: audits/signal_handlers/login_log.py:32 authentication/views/feishu.py:144
|
#: audits/signal_handlers/login_log.py:32 authentication/views/feishu.py:144
|
||||||
#: authentication/views/login.py:85 notifications/backends/__init__.py:14
|
#: authentication/views/login.py:86 notifications/backends/__init__.py:14
|
||||||
#: settings/serializers/auth/feishu.py:10 users/models/user.py:780
|
#: settings/serializers/auth/feishu.py:10 users/models/user.py:780
|
||||||
msgid "FeiShu"
|
msgid "FeiShu"
|
||||||
msgstr "本を飛ばす"
|
msgstr "本を飛ばす"
|
||||||
|
|
||||||
#: audits/signal_handlers/login_log.py:33 authentication/views/dingtalk.py:179
|
#: audits/signal_handlers/login_log.py:33 authentication/views/dingtalk.py:179
|
||||||
#: authentication/views/login.py:79 notifications/backends/__init__.py:12
|
#: authentication/views/login.py:80 notifications/backends/__init__.py:12
|
||||||
#: settings/serializers/auth/dingtalk.py:10 users/models/user.py:779
|
#: settings/serializers/auth/dingtalk.py:10 users/models/user.py:779
|
||||||
msgid "DingTalk"
|
msgid "DingTalk"
|
||||||
msgstr "DingTalk"
|
msgstr "DingTalk"
|
||||||
@@ -2237,15 +2235,15 @@ msgstr "本を飛ばすは拘束されていません"
|
|||||||
msgid "Your password is invalid"
|
msgid "Your password is invalid"
|
||||||
msgstr "パスワードが無効です"
|
msgstr "パスワードが無効です"
|
||||||
|
|
||||||
#: authentication/errors/redirect.py:85 authentication/mixins.py:306
|
#: authentication/errors/redirect.py:85 authentication/mixins.py:307
|
||||||
msgid "Your password is too simple, please change it for security"
|
msgid "Your password is too simple, please change it for security"
|
||||||
msgstr "パスワードがシンプルすぎるので、セキュリティのために変更してください"
|
msgstr "パスワードがシンプルすぎるので、セキュリティのために変更してください"
|
||||||
|
|
||||||
#: authentication/errors/redirect.py:93 authentication/mixins.py:313
|
#: authentication/errors/redirect.py:93 authentication/mixins.py:314
|
||||||
msgid "You should to change your password before login"
|
msgid "You should to change your password before login"
|
||||||
msgstr "ログインする前にパスワードを変更する必要があります"
|
msgstr "ログインする前にパスワードを変更する必要があります"
|
||||||
|
|
||||||
#: authentication/errors/redirect.py:101 authentication/mixins.py:320
|
#: authentication/errors/redirect.py:101 authentication/mixins.py:321
|
||||||
msgid "Your password has expired, please reset before logging in"
|
msgid "Your password has expired, please reset before logging in"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"パスワードの有効期限が切れました。ログインする前にリセットしてください。"
|
"パスワードの有効期限が切れました。ログインする前にリセットしてください。"
|
||||||
@@ -2348,11 +2346,11 @@ msgstr "無効にする電話番号をクリアする"
|
|||||||
msgid "Authentication failed (before login check failed): {}"
|
msgid "Authentication failed (before login check failed): {}"
|
||||||
msgstr "認証に失敗しました (ログインチェックが失敗する前): {}"
|
msgstr "認証に失敗しました (ログインチェックが失敗する前): {}"
|
||||||
|
|
||||||
#: authentication/mixins.py:256
|
#: authentication/mixins.py:257
|
||||||
msgid "The MFA type ({}) is not enabled"
|
msgid "The MFA type ({}) is not enabled"
|
||||||
msgstr "MFAタイプ ({}) が有効になっていない"
|
msgstr "MFAタイプ ({}) が有効になっていない"
|
||||||
|
|
||||||
#: authentication/mixins.py:296
|
#: authentication/mixins.py:297
|
||||||
msgid "Please change your password"
|
msgid "Please change your password"
|
||||||
msgstr "パスワードを変更してください"
|
msgstr "パスワードを変更してください"
|
||||||
|
|
||||||
@@ -2812,19 +2810,23 @@ msgstr "本を飛ばすからユーザーを取得できませんでした"
|
|||||||
msgid "Please login with a password and then bind the FeiShu"
|
msgid "Please login with a password and then bind the FeiShu"
|
||||||
msgstr "パスワードでログインしてから本を飛ばすをバインドしてください"
|
msgstr "パスワードでログインしてから本を飛ばすをバインドしてください"
|
||||||
|
|
||||||
#: authentication/views/login.py:181
|
#: authentication/views/login.py:182
|
||||||
msgid "Redirecting"
|
msgid "Redirecting"
|
||||||
msgstr "リダイレクト"
|
msgstr "リダイレクト"
|
||||||
|
|
||||||
#: authentication/views/login.py:182
|
#: authentication/views/login.py:183
|
||||||
msgid "Redirecting to {} authentication"
|
msgid "Redirecting to {} authentication"
|
||||||
msgstr "{} 認証へのリダイレクト"
|
msgstr "{} 認証へのリダイレクト"
|
||||||
|
|
||||||
#: authentication/views/login.py:205
|
#: authentication/views/login.py:206
|
||||||
msgid "Please enable cookies and try again."
|
msgid "Please enable cookies and try again."
|
||||||
msgstr "クッキーを有効にして、もう一度お試しください。"
|
msgstr "クッキーを有効にして、もう一度お試しください。"
|
||||||
|
|
||||||
#: authentication/views/login.py:307
|
#: authentication/views/login.py:238
|
||||||
|
msgid "User email already exists ({})"
|
||||||
|
msgstr "ユーザー メールボックスは既に存在します ({})"
|
||||||
|
|
||||||
|
#: authentication/views/login.py:318
|
||||||
msgid ""
|
msgid ""
|
||||||
"Wait for <b>{}</b> confirm, You also can copy link to her/him <br/>\n"
|
"Wait for <b>{}</b> confirm, You also can copy link to her/him <br/>\n"
|
||||||
" Don't close this page"
|
" Don't close this page"
|
||||||
@@ -2832,15 +2834,15 @@ msgstr ""
|
|||||||
"<b>{}</b> 確認を待ちます。彼女/彼へのリンクをコピーすることもできます <br/>\n"
|
"<b>{}</b> 確認を待ちます。彼女/彼へのリンクをコピーすることもできます <br/>\n"
|
||||||
" このページを閉じないでください"
|
" このページを閉じないでください"
|
||||||
|
|
||||||
#: authentication/views/login.py:312
|
#: authentication/views/login.py:323
|
||||||
msgid "No ticket found"
|
msgid "No ticket found"
|
||||||
msgstr "チケットが見つかりません"
|
msgstr "チケットが見つかりません"
|
||||||
|
|
||||||
#: authentication/views/login.py:348
|
#: authentication/views/login.py:359
|
||||||
msgid "Logout success"
|
msgid "Logout success"
|
||||||
msgstr "ログアウト成功"
|
msgstr "ログアウト成功"
|
||||||
|
|
||||||
#: authentication/views/login.py:349
|
#: authentication/views/login.py:360
|
||||||
msgid "Logout success, return login page"
|
msgid "Logout success, return login page"
|
||||||
msgstr "ログアウト成功、ログインページを返す"
|
msgstr "ログアウト成功、ログインページを返す"
|
||||||
|
|
||||||
@@ -3509,15 +3511,15 @@ msgstr "終了しました"
|
|||||||
msgid "Time cost"
|
msgid "Time cost"
|
||||||
msgstr "時を過ごす"
|
msgstr "時を過ごす"
|
||||||
|
|
||||||
#: ops/tasks.py:32
|
#: ops/tasks.py:34
|
||||||
msgid "Run ansible task"
|
msgid "Run ansible task"
|
||||||
msgstr "Ansible タスクを実行する"
|
msgstr "Ansible タスクを実行する"
|
||||||
|
|
||||||
#: ops/tasks.py:61
|
#: ops/tasks.py:63
|
||||||
msgid "Run ansible task execution"
|
msgid "Run ansible task execution"
|
||||||
msgstr "Ansible タスクの実行を開始する"
|
msgstr "Ansible タスクの実行を開始する"
|
||||||
|
|
||||||
#: ops/tasks.py:77
|
#: ops/tasks.py:79
|
||||||
msgid "Clear celery periodic tasks"
|
msgid "Clear celery periodic tasks"
|
||||||
msgstr "タスクログを定期的にクリアする"
|
msgstr "タスクログを定期的にクリアする"
|
||||||
|
|
||||||
@@ -3735,7 +3737,7 @@ msgstr "内部の役割は、破壊することはできません"
|
|||||||
msgid "The role has been bound to users, can't be destroy"
|
msgid "The role has been bound to users, can't be destroy"
|
||||||
msgstr "ロールはユーザーにバインドされており、破壊することはできません"
|
msgstr "ロールはユーザーにバインドされており、破壊することはできません"
|
||||||
|
|
||||||
#: rbac/api/role.py:83
|
#: rbac/api/role.py:87
|
||||||
msgid "Internal role, can't be update"
|
msgid "Internal role, can't be update"
|
||||||
msgstr "内部ロール、更新できません"
|
msgstr "内部ロール、更新できません"
|
||||||
|
|
||||||
@@ -3747,27 +3749,27 @@ msgstr "{} 少なくとも1つのシステムロール"
|
|||||||
msgid "RBAC"
|
msgid "RBAC"
|
||||||
msgstr "RBAC"
|
msgstr "RBAC"
|
||||||
|
|
||||||
#: rbac/builtin.py:109
|
#: rbac/builtin.py:113
|
||||||
msgid "SystemAdmin"
|
msgid "SystemAdmin"
|
||||||
msgstr "システム管理者"
|
msgstr "システム管理者"
|
||||||
|
|
||||||
#: rbac/builtin.py:112
|
#: rbac/builtin.py:116
|
||||||
msgid "SystemAuditor"
|
msgid "SystemAuditor"
|
||||||
msgstr "システム監査人"
|
msgstr "システム監査人"
|
||||||
|
|
||||||
#: rbac/builtin.py:115
|
#: rbac/builtin.py:119
|
||||||
msgid "SystemComponent"
|
msgid "SystemComponent"
|
||||||
msgstr "システムコンポーネント"
|
msgstr "システムコンポーネント"
|
||||||
|
|
||||||
#: rbac/builtin.py:121
|
#: rbac/builtin.py:125
|
||||||
msgid "OrgAdmin"
|
msgid "OrgAdmin"
|
||||||
msgstr "組織管理者"
|
msgstr "組織管理者"
|
||||||
|
|
||||||
#: rbac/builtin.py:124
|
#: rbac/builtin.py:128
|
||||||
msgid "OrgAuditor"
|
msgid "OrgAuditor"
|
||||||
msgstr "監査員を組織する"
|
msgstr "監査員を組織する"
|
||||||
|
|
||||||
#: rbac/builtin.py:127
|
#: rbac/builtin.py:131
|
||||||
msgid "OrgUser"
|
msgid "OrgUser"
|
||||||
msgstr "組織ユーザー"
|
msgstr "組織ユーザー"
|
||||||
|
|
||||||
@@ -5408,9 +5410,9 @@ msgstr "セッション"
|
|||||||
msgid "Risk level"
|
msgid "Risk level"
|
||||||
msgstr "リスクレベル"
|
msgstr "リスクレベル"
|
||||||
|
|
||||||
#: terminal/connect_methods.py:47 terminal/connect_methods.py:48
|
#: terminal/connect_methods.py:54 terminal/connect_methods.py:55
|
||||||
#: terminal/connect_methods.py:49 terminal/connect_methods.py:50
|
#: terminal/connect_methods.py:56 terminal/connect_methods.py:57
|
||||||
#: terminal/connect_methods.py:51
|
#: terminal/connect_methods.py:58
|
||||||
msgid "DB Client"
|
msgid "DB Client"
|
||||||
msgstr "データベース クライアント"
|
msgstr "データベース クライアント"
|
||||||
|
|
||||||
@@ -5899,11 +5901,11 @@ msgstr "孤立したセッションをクリアする"
|
|||||||
msgid "Upload session replay to external storage"
|
msgid "Upload session replay to external storage"
|
||||||
msgstr "セッションの記録を外部ストレージにアップロードする"
|
msgstr "セッションの記録を外部ストレージにアップロードする"
|
||||||
|
|
||||||
#: terminal/tasks.py:83
|
#: terminal/tasks.py:84
|
||||||
msgid "Run applet host deployment"
|
msgid "Run applet host deployment"
|
||||||
msgstr "アプリケーション マシンの展開を実行する"
|
msgstr "アプリケーション マシンの展開を実行する"
|
||||||
|
|
||||||
#: terminal/tasks.py:90
|
#: terminal/tasks.py:94
|
||||||
msgid "Install applet"
|
msgid "Install applet"
|
||||||
msgstr "アプリをインストールする"
|
msgstr "アプリをインストールする"
|
||||||
|
|
||||||
@@ -7388,30 +7390,3 @@ msgstr "究極のエディション"
|
|||||||
#: xpack/plugins/license/models.py:85
|
#: xpack/plugins/license/models.py:85
|
||||||
msgid "Community edition"
|
msgid "Community edition"
|
||||||
msgstr "コミュニティ版"
|
msgstr "コミュニティ版"
|
||||||
|
|
||||||
#, fuzzy
|
|
||||||
#~| msgid "Only admin users"
|
|
||||||
#~ msgid "Unix admin user"
|
|
||||||
#~ msgstr "管理者のみ"
|
|
||||||
|
|
||||||
#, fuzzy
|
|
||||||
#~| msgid "Only admin users"
|
|
||||||
#~ msgid "Windows admin user"
|
|
||||||
#~ msgstr "管理者のみ"
|
|
||||||
|
|
||||||
#, fuzzy
|
|
||||||
#~| msgid "Only admin users"
|
|
||||||
#~ msgid "Linux admin user"
|
|
||||||
#~ msgstr "管理者のみ"
|
|
||||||
|
|
||||||
#~ msgid "Can push account to asset"
|
|
||||||
#~ msgstr "アカウントをアセットにプッシュできます"
|
|
||||||
|
|
||||||
#~ msgid "Add asset to node"
|
|
||||||
#~ msgstr "ノードにアセットを追加する"
|
|
||||||
|
|
||||||
#~ msgid "Move asset to node"
|
|
||||||
#~ msgstr "アセットをノードに移動する"
|
|
||||||
|
|
||||||
#~ msgid "Remove asset from node"
|
|
||||||
#~ msgstr "ノードからアセットを削除"
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: JumpServer 0.3.3\n"
|
"Project-Id-Version: JumpServer 0.3.3\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2023-02-23 19:11+0800\n"
|
"POT-Creation-Date: 2023-03-02 16:00+0800\n"
|
||||||
"PO-Revision-Date: 2021-05-20 10:54+0800\n"
|
"PO-Revision-Date: 2021-05-20 10:54+0800\n"
|
||||||
"Last-Translator: ibuler <ibuler@qq.com>\n"
|
"Last-Translator: ibuler <ibuler@qq.com>\n"
|
||||||
"Language-Team: JumpServer team<ibuler@qq.com>\n"
|
"Language-Team: JumpServer team<ibuler@qq.com>\n"
|
||||||
@@ -393,7 +393,7 @@ msgid "Date last login"
|
|||||||
msgstr "最后登录日期"
|
msgstr "最后登录日期"
|
||||||
|
|
||||||
#: accounts/models/automations/gather_account.py:15
|
#: accounts/models/automations/gather_account.py:15
|
||||||
#: accounts/models/automations/push_account.py:13 accounts/models/base.py:34
|
#: accounts/models/automations/push_account.py:14 accounts/models/base.py:34
|
||||||
#: acls/serializers/base.py:18 acls/serializers/base.py:49
|
#: acls/serializers/base.py:18 acls/serializers/base.py:49
|
||||||
#: assets/models/_user.py:23 audits/models.py:157 authentication/forms.py:25
|
#: assets/models/_user.py:23 audits/models.py:157 authentication/forms.py:25
|
||||||
#: authentication/forms.py:27 authentication/models/temp_token.py:9
|
#: authentication/forms.py:27 authentication/models/temp_token.py:9
|
||||||
@@ -418,11 +418,11 @@ msgstr "自动化收集账号"
|
|||||||
msgid "Gather asset accounts"
|
msgid "Gather asset accounts"
|
||||||
msgstr "收集账号"
|
msgstr "收集账号"
|
||||||
|
|
||||||
#: accounts/models/automations/push_account.py:12
|
#: accounts/models/automations/push_account.py:13
|
||||||
msgid "Triggers"
|
msgid "Triggers"
|
||||||
msgstr "触发方式"
|
msgstr "触发方式"
|
||||||
|
|
||||||
#: accounts/models/automations/push_account.py:14 acls/models/base.py:81
|
#: accounts/models/automations/push_account.py:15 acls/models/base.py:81
|
||||||
#: acls/serializers/base.py:81 acls/serializers/login_acl.py:25
|
#: acls/serializers/base.py:81 acls/serializers/login_acl.py:25
|
||||||
#: assets/models/cmd_filter.py:81 audits/models.py:65 audits/serializers.py:82
|
#: assets/models/cmd_filter.py:81 audits/models.py:65 audits/serializers.py:82
|
||||||
#: authentication/serializers/connect_token_secret.py:109
|
#: authentication/serializers/connect_token_secret.py:109
|
||||||
@@ -430,7 +430,7 @@ msgstr "触发方式"
|
|||||||
msgid "Action"
|
msgid "Action"
|
||||||
msgstr "动作"
|
msgstr "动作"
|
||||||
|
|
||||||
#: accounts/models/automations/push_account.py:40
|
#: accounts/models/automations/push_account.py:43
|
||||||
msgid "Push asset account"
|
msgid "Push asset account"
|
||||||
msgstr "账号推送"
|
msgstr "账号推送"
|
||||||
|
|
||||||
@@ -446,7 +446,7 @@ msgstr "账号验证"
|
|||||||
#: assets/models/group.py:20 assets/models/label.py:18
|
#: assets/models/group.py:20 assets/models/label.py:18
|
||||||
#: assets/models/platform.py:21 assets/models/platform.py:76
|
#: assets/models/platform.py:21 assets/models/platform.py:76
|
||||||
#: assets/serializers/asset/common.py:67 assets/serializers/asset/common.py:143
|
#: assets/serializers/asset/common.py:67 assets/serializers/asset/common.py:143
|
||||||
#: assets/serializers/platform.py:91 assets/serializers/platform.py:136
|
#: assets/serializers/platform.py:133
|
||||||
#: authentication/serializers/connect_token_secret.py:103 ops/mixin.py:21
|
#: authentication/serializers/connect_token_secret.py:103 ops/mixin.py:21
|
||||||
#: ops/models/adhoc.py:21 ops/models/celery.py:15 ops/models/celery.py:57
|
#: ops/models/adhoc.py:21 ops/models/celery.py:15 ops/models/celery.py:57
|
||||||
#: ops/models/job.py:91 ops/models/playbook.py:23 ops/serializers/job.py:19
|
#: ops/models/job.py:91 ops/models/playbook.py:23 ops/serializers/job.py:19
|
||||||
@@ -529,7 +529,7 @@ msgstr "已托管密码"
|
|||||||
#: accounts/serializers/account/account.py:75 applications/models.py:11
|
#: accounts/serializers/account/account.py:75 applications/models.py:11
|
||||||
#: assets/models/label.py:21 assets/models/platform.py:77
|
#: assets/models/label.py:21 assets/models/platform.py:77
|
||||||
#: assets/serializers/asset/common.py:120 assets/serializers/cagegory.py:8
|
#: assets/serializers/asset/common.py:120 assets/serializers/cagegory.py:8
|
||||||
#: assets/serializers/platform.py:97 assets/serializers/platform.py:137
|
#: assets/serializers/platform.py:94 assets/serializers/platform.py:134
|
||||||
#: perms/serializers/user_permission.py:26 settings/models.py:35
|
#: perms/serializers/user_permission.py:26 settings/models.py:35
|
||||||
#: tickets/models/ticket/apply_application.py:13
|
#: tickets/models/ticket/apply_application.py:13
|
||||||
msgid "Category"
|
msgid "Category"
|
||||||
@@ -540,7 +540,7 @@ msgstr "类别"
|
|||||||
#: acls/serializers/command_acl.py:18 applications/models.py:14
|
#: acls/serializers/command_acl.py:18 applications/models.py:14
|
||||||
#: assets/models/_user.py:50 assets/models/automations/base.py:20
|
#: assets/models/_user.py:50 assets/models/automations/base.py:20
|
||||||
#: assets/models/cmd_filter.py:74 assets/models/platform.py:78
|
#: assets/models/cmd_filter.py:74 assets/models/platform.py:78
|
||||||
#: assets/serializers/asset/common.py:121 assets/serializers/platform.py:96
|
#: assets/serializers/asset/common.py:121 assets/serializers/platform.py:93
|
||||||
#: audits/serializers.py:48
|
#: audits/serializers.py:48
|
||||||
#: authentication/serializers/connect_token_secret.py:116 ops/models/job.py:102
|
#: authentication/serializers/connect_token_secret.py:116 ops/models/job.py:102
|
||||||
#: perms/serializers/user_permission.py:27 terminal/models/applet/applet.py:31
|
#: perms/serializers/user_permission.py:27 terminal/models/applet/applet.py:31
|
||||||
@@ -737,7 +737,7 @@ msgstr "激活中"
|
|||||||
#: authentication/models/sso_token.py:16
|
#: authentication/models/sso_token.py:16
|
||||||
#: notifications/models/notification.py:12
|
#: notifications/models/notification.py:12
|
||||||
#: perms/api/user_permission/mixin.py:55 perms/models/asset_permission.py:58
|
#: perms/api/user_permission/mixin.py:55 perms/models/asset_permission.py:58
|
||||||
#: perms/serializers/permission.py:23 rbac/builtin.py:118
|
#: perms/serializers/permission.py:23 rbac/builtin.py:122
|
||||||
#: rbac/models/rolebinding.py:49 terminal/backends/command/models.py:19
|
#: rbac/models/rolebinding.py:49 terminal/backends/command/models.py:19
|
||||||
#: terminal/models/session/session.py:30 terminal/models/session/sharing.py:32
|
#: terminal/models/session/session.py:30 terminal/models/session/sharing.py:32
|
||||||
#: terminal/notifications.py:96 terminal/notifications.py:144
|
#: terminal/notifications.py:96 terminal/notifications.py:144
|
||||||
@@ -902,7 +902,7 @@ msgstr "应用程序"
|
|||||||
msgid "Can match application"
|
msgid "Can match application"
|
||||||
msgstr "匹配应用"
|
msgstr "匹配应用"
|
||||||
|
|
||||||
#: assets/api/asset/asset.py:142
|
#: assets/api/asset/asset.py:143
|
||||||
msgid "Cannot create asset directly, you should create a host or other"
|
msgid "Cannot create asset directly, you should create a host or other"
|
||||||
msgstr "不能直接创建资产, 你应该创建主机或其他资产"
|
msgstr "不能直接创建资产, 你应该创建主机或其他资产"
|
||||||
|
|
||||||
@@ -936,10 +936,8 @@ msgid "No account"
|
|||||||
msgstr "没有账号"
|
msgstr "没有账号"
|
||||||
|
|
||||||
#: assets/automations/ping_gateway/manager.py:36
|
#: assets/automations/ping_gateway/manager.py:36
|
||||||
#, fuzzy
|
|
||||||
#| msgid "Assets amount"
|
|
||||||
msgid "Asset, {}, using account {}"
|
msgid "Asset, {}, using account {}"
|
||||||
msgstr "资产数量"
|
msgstr "资产, {}, 使用账号 {}"
|
||||||
|
|
||||||
#: assets/automations/ping_gateway/manager.py:55
|
#: assets/automations/ping_gateway/manager.py:55
|
||||||
#, python-brace-format
|
#, python-brace-format
|
||||||
@@ -1451,23 +1449,23 @@ msgstr "元数据"
|
|||||||
msgid "Internal"
|
msgid "Internal"
|
||||||
msgstr "内置"
|
msgstr "内置"
|
||||||
|
|
||||||
#: assets/models/platform.py:83 assets/serializers/platform.py:94
|
#: assets/models/platform.py:83 assets/serializers/platform.py:91
|
||||||
msgid "Charset"
|
msgid "Charset"
|
||||||
msgstr "编码"
|
msgstr "编码"
|
||||||
|
|
||||||
#: assets/models/platform.py:85 assets/serializers/platform.py:122
|
#: assets/models/platform.py:85 assets/serializers/platform.py:119
|
||||||
msgid "Domain enabled"
|
msgid "Domain enabled"
|
||||||
msgstr "启用网域"
|
msgstr "启用网域"
|
||||||
|
|
||||||
#: assets/models/platform.py:87 assets/serializers/platform.py:121
|
#: assets/models/platform.py:87 assets/serializers/platform.py:118
|
||||||
msgid "Su enabled"
|
msgid "Su enabled"
|
||||||
msgstr "启用账号切换"
|
msgstr "启用账号切换"
|
||||||
|
|
||||||
#: assets/models/platform.py:88 assets/serializers/platform.py:104
|
#: assets/models/platform.py:88 assets/serializers/platform.py:101
|
||||||
msgid "Su method"
|
msgid "Su method"
|
||||||
msgstr "账号切换方式"
|
msgstr "账号切换方式"
|
||||||
|
|
||||||
#: assets/models/platform.py:90 assets/serializers/platform.py:101
|
#: assets/models/platform.py:90 assets/serializers/platform.py:98
|
||||||
msgid "Automation"
|
msgid "Automation"
|
||||||
msgstr "自动化"
|
msgstr "自动化"
|
||||||
|
|
||||||
@@ -1480,7 +1478,7 @@ msgstr "%(value)s is not an even number"
|
|||||||
msgid "Auto fill"
|
msgid "Auto fill"
|
||||||
msgstr "自动代填"
|
msgstr "自动代填"
|
||||||
|
|
||||||
#: assets/serializers/asset/common.py:123 assets/serializers/platform.py:99
|
#: assets/serializers/asset/common.py:123 assets/serializers/platform.py:96
|
||||||
#: authentication/serializers/connect_token_secret.py:28
|
#: authentication/serializers/connect_token_secret.py:28
|
||||||
#: authentication/serializers/connect_token_secret.py:66
|
#: authentication/serializers/connect_token_secret.py:66
|
||||||
#: perms/serializers/user_permission.py:25 xpack/plugins/cloud/models.py:99
|
#: perms/serializers/user_permission.py:25 xpack/plugins/cloud/models.py:99
|
||||||
@@ -1621,7 +1619,7 @@ msgstr "收集账号方式"
|
|||||||
msgid "Primary"
|
msgid "Primary"
|
||||||
msgstr "主要的"
|
msgstr "主要的"
|
||||||
|
|
||||||
#: assets/serializers/platform.py:123
|
#: assets/serializers/platform.py:120
|
||||||
msgid "Default Domain"
|
msgid "Default Domain"
|
||||||
msgstr "默认网域"
|
msgstr "默认网域"
|
||||||
|
|
||||||
@@ -1930,20 +1928,20 @@ msgid "Auth Token"
|
|||||||
msgstr "认证令牌"
|
msgstr "认证令牌"
|
||||||
|
|
||||||
#: audits/signal_handlers/login_log.py:31 authentication/notifications.py:73
|
#: audits/signal_handlers/login_log.py:31 authentication/notifications.py:73
|
||||||
#: authentication/views/login.py:73 authentication/views/wecom.py:177
|
#: authentication/views/login.py:74 authentication/views/wecom.py:177
|
||||||
#: notifications/backends/__init__.py:11 settings/serializers/auth/wecom.py:10
|
#: notifications/backends/__init__.py:11 settings/serializers/auth/wecom.py:10
|
||||||
#: users/models/user.py:778
|
#: users/models/user.py:778
|
||||||
msgid "WeCom"
|
msgid "WeCom"
|
||||||
msgstr "企业微信"
|
msgstr "企业微信"
|
||||||
|
|
||||||
#: audits/signal_handlers/login_log.py:32 authentication/views/feishu.py:144
|
#: audits/signal_handlers/login_log.py:32 authentication/views/feishu.py:144
|
||||||
#: authentication/views/login.py:85 notifications/backends/__init__.py:14
|
#: authentication/views/login.py:86 notifications/backends/__init__.py:14
|
||||||
#: settings/serializers/auth/feishu.py:10 users/models/user.py:780
|
#: settings/serializers/auth/feishu.py:10 users/models/user.py:780
|
||||||
msgid "FeiShu"
|
msgid "FeiShu"
|
||||||
msgstr "飞书"
|
msgstr "飞书"
|
||||||
|
|
||||||
#: audits/signal_handlers/login_log.py:33 authentication/views/dingtalk.py:179
|
#: audits/signal_handlers/login_log.py:33 authentication/views/dingtalk.py:179
|
||||||
#: authentication/views/login.py:79 notifications/backends/__init__.py:12
|
#: authentication/views/login.py:80 notifications/backends/__init__.py:12
|
||||||
#: settings/serializers/auth/dingtalk.py:10 users/models/user.py:779
|
#: settings/serializers/auth/dingtalk.py:10 users/models/user.py:779
|
||||||
msgid "DingTalk"
|
msgid "DingTalk"
|
||||||
msgstr "钉钉"
|
msgstr "钉钉"
|
||||||
@@ -2217,15 +2215,15 @@ msgstr "没有绑定飞书"
|
|||||||
msgid "Your password is invalid"
|
msgid "Your password is invalid"
|
||||||
msgstr "您的密码无效"
|
msgstr "您的密码无效"
|
||||||
|
|
||||||
#: authentication/errors/redirect.py:85 authentication/mixins.py:306
|
#: authentication/errors/redirect.py:85 authentication/mixins.py:307
|
||||||
msgid "Your password is too simple, please change it for security"
|
msgid "Your password is too simple, please change it for security"
|
||||||
msgstr "你的密码过于简单,为了安全,请修改"
|
msgstr "你的密码过于简单,为了安全,请修改"
|
||||||
|
|
||||||
#: authentication/errors/redirect.py:93 authentication/mixins.py:313
|
#: authentication/errors/redirect.py:93 authentication/mixins.py:314
|
||||||
msgid "You should to change your password before login"
|
msgid "You should to change your password before login"
|
||||||
msgstr "登录完成前,请先修改密码"
|
msgstr "登录完成前,请先修改密码"
|
||||||
|
|
||||||
#: authentication/errors/redirect.py:101 authentication/mixins.py:320
|
#: authentication/errors/redirect.py:101 authentication/mixins.py:321
|
||||||
msgid "Your password has expired, please reset before logging in"
|
msgid "Your password has expired, please reset before logging in"
|
||||||
msgstr "您的密码已过期,先修改再登录"
|
msgstr "您的密码已过期,先修改再登录"
|
||||||
|
|
||||||
@@ -2326,11 +2324,11 @@ msgstr "清空手机号码禁用"
|
|||||||
msgid "Authentication failed (before login check failed): {}"
|
msgid "Authentication failed (before login check failed): {}"
|
||||||
msgstr "认证失败(登录前检查失败): {}"
|
msgstr "认证失败(登录前检查失败): {}"
|
||||||
|
|
||||||
#: authentication/mixins.py:256
|
#: authentication/mixins.py:257
|
||||||
msgid "The MFA type ({}) is not enabled"
|
msgid "The MFA type ({}) is not enabled"
|
||||||
msgstr "该 MFA ({}) 方式没有启用"
|
msgstr "该 MFA ({}) 方式没有启用"
|
||||||
|
|
||||||
#: authentication/mixins.py:296
|
#: authentication/mixins.py:297
|
||||||
msgid "Please change your password"
|
msgid "Please change your password"
|
||||||
msgstr "请修改密码"
|
msgstr "请修改密码"
|
||||||
|
|
||||||
@@ -2782,19 +2780,23 @@ msgstr "从飞书获取用户失败"
|
|||||||
msgid "Please login with a password and then bind the FeiShu"
|
msgid "Please login with a password and then bind the FeiShu"
|
||||||
msgstr "请使用密码登录,然后绑定飞书"
|
msgstr "请使用密码登录,然后绑定飞书"
|
||||||
|
|
||||||
#: authentication/views/login.py:181
|
#: authentication/views/login.py:182
|
||||||
msgid "Redirecting"
|
msgid "Redirecting"
|
||||||
msgstr "跳转中"
|
msgstr "跳转中"
|
||||||
|
|
||||||
#: authentication/views/login.py:182
|
#: authentication/views/login.py:183
|
||||||
msgid "Redirecting to {} authentication"
|
msgid "Redirecting to {} authentication"
|
||||||
msgstr "正在跳转到 {} 认证"
|
msgstr "正在跳转到 {} 认证"
|
||||||
|
|
||||||
#: authentication/views/login.py:205
|
#: authentication/views/login.py:206
|
||||||
msgid "Please enable cookies and try again."
|
msgid "Please enable cookies and try again."
|
||||||
msgstr "设置你的浏览器支持cookie"
|
msgstr "设置你的浏览器支持cookie"
|
||||||
|
|
||||||
#: authentication/views/login.py:307
|
#: authentication/views/login.py:238
|
||||||
|
msgid "User email already exists ({})"
|
||||||
|
msgstr "用户邮箱已存在 ({})"
|
||||||
|
|
||||||
|
#: authentication/views/login.py:318
|
||||||
msgid ""
|
msgid ""
|
||||||
"Wait for <b>{}</b> confirm, You also can copy link to her/him <br/>\n"
|
"Wait for <b>{}</b> confirm, You also can copy link to her/him <br/>\n"
|
||||||
" Don't close this page"
|
" Don't close this page"
|
||||||
@@ -2802,15 +2804,15 @@ msgstr ""
|
|||||||
"等待 <b>{}</b> 确认, 你也可以复制链接发给他/她 <br/>\n"
|
"等待 <b>{}</b> 确认, 你也可以复制链接发给他/她 <br/>\n"
|
||||||
" 不要关闭本页面"
|
" 不要关闭本页面"
|
||||||
|
|
||||||
#: authentication/views/login.py:312
|
#: authentication/views/login.py:323
|
||||||
msgid "No ticket found"
|
msgid "No ticket found"
|
||||||
msgstr "没有发现工单"
|
msgstr "没有发现工单"
|
||||||
|
|
||||||
#: authentication/views/login.py:348
|
#: authentication/views/login.py:359
|
||||||
msgid "Logout success"
|
msgid "Logout success"
|
||||||
msgstr "退出登录成功"
|
msgstr "退出登录成功"
|
||||||
|
|
||||||
#: authentication/views/login.py:349
|
#: authentication/views/login.py:360
|
||||||
msgid "Logout success, return login page"
|
msgid "Logout success, return login page"
|
||||||
msgstr "退出登录成功,返回到登录页面"
|
msgstr "退出登录成功,返回到登录页面"
|
||||||
|
|
||||||
@@ -3474,15 +3476,15 @@ msgstr "是否完成"
|
|||||||
msgid "Time cost"
|
msgid "Time cost"
|
||||||
msgstr "花费时间"
|
msgstr "花费时间"
|
||||||
|
|
||||||
#: ops/tasks.py:32
|
#: ops/tasks.py:34
|
||||||
msgid "Run ansible task"
|
msgid "Run ansible task"
|
||||||
msgstr "运行 Ansible 任务"
|
msgstr "运行 Ansible 任务"
|
||||||
|
|
||||||
#: ops/tasks.py:61
|
#: ops/tasks.py:63
|
||||||
msgid "Run ansible task execution"
|
msgid "Run ansible task execution"
|
||||||
msgstr "开始执行 Ansible 任务"
|
msgstr "开始执行 Ansible 任务"
|
||||||
|
|
||||||
#: ops/tasks.py:77
|
#: ops/tasks.py:79
|
||||||
msgid "Clear celery periodic tasks"
|
msgid "Clear celery periodic tasks"
|
||||||
msgstr "清理周期任务"
|
msgstr "清理周期任务"
|
||||||
|
|
||||||
@@ -3699,7 +3701,7 @@ msgstr "内部角色,不能删除"
|
|||||||
msgid "The role has been bound to users, can't be destroy"
|
msgid "The role has been bound to users, can't be destroy"
|
||||||
msgstr "角色已绑定用户,不能删除"
|
msgstr "角色已绑定用户,不能删除"
|
||||||
|
|
||||||
#: rbac/api/role.py:83
|
#: rbac/api/role.py:87
|
||||||
msgid "Internal role, can't be update"
|
msgid "Internal role, can't be update"
|
||||||
msgstr "内部角色,不能更新"
|
msgstr "内部角色,不能更新"
|
||||||
|
|
||||||
@@ -3711,27 +3713,27 @@ msgstr "{} 至少有一个系统角色"
|
|||||||
msgid "RBAC"
|
msgid "RBAC"
|
||||||
msgstr "RBAC"
|
msgstr "RBAC"
|
||||||
|
|
||||||
#: rbac/builtin.py:109
|
#: rbac/builtin.py:113
|
||||||
msgid "SystemAdmin"
|
msgid "SystemAdmin"
|
||||||
msgstr "系统管理员"
|
msgstr "系统管理员"
|
||||||
|
|
||||||
#: rbac/builtin.py:112
|
#: rbac/builtin.py:116
|
||||||
msgid "SystemAuditor"
|
msgid "SystemAuditor"
|
||||||
msgstr "系统审计员"
|
msgstr "系统审计员"
|
||||||
|
|
||||||
#: rbac/builtin.py:115
|
#: rbac/builtin.py:119
|
||||||
msgid "SystemComponent"
|
msgid "SystemComponent"
|
||||||
msgstr "系统组件"
|
msgstr "系统组件"
|
||||||
|
|
||||||
#: rbac/builtin.py:121
|
#: rbac/builtin.py:125
|
||||||
msgid "OrgAdmin"
|
msgid "OrgAdmin"
|
||||||
msgstr "组织管理员"
|
msgstr "组织管理员"
|
||||||
|
|
||||||
#: rbac/builtin.py:124
|
#: rbac/builtin.py:128
|
||||||
msgid "OrgAuditor"
|
msgid "OrgAuditor"
|
||||||
msgstr "组织审计员"
|
msgstr "组织审计员"
|
||||||
|
|
||||||
#: rbac/builtin.py:127
|
#: rbac/builtin.py:131
|
||||||
msgid "OrgUser"
|
msgid "OrgUser"
|
||||||
msgstr "组织用户"
|
msgstr "组织用户"
|
||||||
|
|
||||||
@@ -5336,9 +5338,9 @@ msgstr "会话"
|
|||||||
msgid "Risk level"
|
msgid "Risk level"
|
||||||
msgstr "风险等级"
|
msgstr "风险等级"
|
||||||
|
|
||||||
#: terminal/connect_methods.py:47 terminal/connect_methods.py:48
|
#: terminal/connect_methods.py:54 terminal/connect_methods.py:55
|
||||||
#: terminal/connect_methods.py:49 terminal/connect_methods.py:50
|
#: terminal/connect_methods.py:56 terminal/connect_methods.py:57
|
||||||
#: terminal/connect_methods.py:51
|
#: terminal/connect_methods.py:58
|
||||||
msgid "DB Client"
|
msgid "DB Client"
|
||||||
msgstr "数据库客户端"
|
msgstr "数据库客户端"
|
||||||
|
|
||||||
@@ -5825,11 +5827,11 @@ msgstr "清除孤儿会话"
|
|||||||
msgid "Upload session replay to external storage"
|
msgid "Upload session replay to external storage"
|
||||||
msgstr "上传会话录像到外部存储"
|
msgstr "上传会话录像到外部存储"
|
||||||
|
|
||||||
#: terminal/tasks.py:83
|
#: terminal/tasks.py:84
|
||||||
msgid "Run applet host deployment"
|
msgid "Run applet host deployment"
|
||||||
msgstr "运行应用机部署"
|
msgstr "运行应用机部署"
|
||||||
|
|
||||||
#: terminal/tasks.py:90
|
#: terminal/tasks.py:94
|
||||||
msgid "Install applet"
|
msgid "Install applet"
|
||||||
msgstr "安装应用"
|
msgstr "安装应用"
|
||||||
|
|
||||||
|
|||||||
@@ -62,10 +62,10 @@ class PlaybookFileBrowserAPIView(APIView):
|
|||||||
rbac_perms = ()
|
rbac_perms = ()
|
||||||
permission_classes = (RBACPermission,)
|
permission_classes = (RBACPermission,)
|
||||||
rbac_perms = {
|
rbac_perms = {
|
||||||
'GET': 'ops.change_playbooks',
|
'GET': 'ops.change_playbook',
|
||||||
'POST': 'ops.change_playbooks',
|
'POST': 'ops.change_playbook',
|
||||||
'DELETE': 'ops.change_playbooks',
|
'DELETE': 'ops.change_playbook',
|
||||||
'PATCH': 'ops.change_playbooks',
|
'PATCH': 'ops.change_playbook',
|
||||||
}
|
}
|
||||||
protected_files = ['root', 'main.yml']
|
protected_files = ['root', 'main.yml']
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,10 @@
|
|||||||
from celery import shared_task
|
from celery import shared_task
|
||||||
from celery.exceptions import SoftTimeLimitExceeded
|
from celery.exceptions import SoftTimeLimitExceeded
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from django_celery_beat.models import PeriodicTask
|
||||||
|
|
||||||
from common.utils import get_logger, get_object_or_none
|
from common.utils import get_logger, get_object_or_none
|
||||||
|
from ops.celery import app
|
||||||
from orgs.utils import tmp_to_org, tmp_to_root_org
|
from orgs.utils import tmp_to_org, tmp_to_root_org
|
||||||
from .celery.decorator import (
|
from .celery.decorator import (
|
||||||
register_as_period_task, after_app_ready_start
|
register_as_period_task, after_app_ready_start
|
||||||
@@ -19,7 +21,7 @@ from .notifications import ServerPerformanceCheckUtil
|
|||||||
logger = get_logger(__file__)
|
logger = get_logger(__file__)
|
||||||
|
|
||||||
|
|
||||||
def job_task_activity_callback(self, job_id, trigger):
|
def job_task_activity_callback(self, job_id, *args, **kwargs):
|
||||||
job = get_object_or_none(Job, id=job_id)
|
job = get_object_or_none(Job, id=job_id)
|
||||||
if not job:
|
if not job:
|
||||||
return
|
return
|
||||||
@@ -48,7 +50,7 @@ def run_ops_job(job_id):
|
|||||||
logger.error("Start adhoc execution error: {}".format(e))
|
logger.error("Start adhoc execution error: {}".format(e))
|
||||||
|
|
||||||
|
|
||||||
def job_execution_task_activity_callback(self, execution_id, trigger):
|
def job_execution_task_activity_callback(self, execution_id, *args, **kwargs):
|
||||||
execution = get_object_or_none(JobExecution, id=execution_id)
|
execution = get_object_or_none(JobExecution, id=execution_id)
|
||||||
if not execution:
|
if not execution:
|
||||||
return
|
return
|
||||||
@@ -78,16 +80,14 @@ def run_ops_job_execution(execution_id, **kwargs):
|
|||||||
@after_app_ready_start
|
@after_app_ready_start
|
||||||
def clean_celery_periodic_tasks():
|
def clean_celery_periodic_tasks():
|
||||||
"""清除celery定时任务"""
|
"""清除celery定时任务"""
|
||||||
need_cleaned_tasks = [
|
logger.info('Start clean celery periodic tasks.')
|
||||||
'handle_be_interrupted_change_auth_task_periodic',
|
register_tasks = PeriodicTask.objects.all()
|
||||||
]
|
for task in register_tasks:
|
||||||
logger.info('Start clean celery periodic tasks: {}'.format(need_cleaned_tasks))
|
if task.task in app.tasks:
|
||||||
for task_name in need_cleaned_tasks:
|
|
||||||
logger.info('Start clean task: {}'.format(task_name))
|
|
||||||
task = get_celery_periodic_task(task_name)
|
|
||||||
if task is None:
|
|
||||||
logger.info('Task does not exist: {}'.format(task_name))
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
task_name = task.name
|
||||||
|
logger.info('Start clean task: {}'.format(task_name))
|
||||||
disable_celery_periodic_task(task_name)
|
disable_celery_periodic_task(task_name)
|
||||||
delete_celery_periodic_task(task_name)
|
delete_celery_periodic_task(task_name)
|
||||||
task = get_celery_periodic_task(task_name)
|
task = get_celery_periodic_task(task_name)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class CeleryTaskLogView(PermissionsMixin, TemplateView):
|
|||||||
template_name = 'ops/celery_task_log.html'
|
template_name = 'ops/celery_task_log.html'
|
||||||
permission_classes = [RBACPermission]
|
permission_classes = [RBACPermission]
|
||||||
rbac_perms = {
|
rbac_perms = {
|
||||||
'GET': 'ops.view_celerytask'
|
'GET': 'ops.view_celerytaskexecution'
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
|
|||||||
@@ -114,9 +114,7 @@ class OrgResourceStatisticsCache(OrgRelatedCache):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def compute_total_count_today_active_assets():
|
def compute_total_count_today_active_assets():
|
||||||
t = local_zero_hour()
|
t = local_zero_hour()
|
||||||
return Session.objects.filter(
|
return Session.objects.filter(date_start__gte=t).values('asset_id').distinct().count()
|
||||||
date_start__gte=t, is_success=False
|
|
||||||
).values('asset_id').distinct().count()
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def compute_total_count_today_failed_sessions():
|
def compute_total_count_today_failed_sessions():
|
||||||
|
|||||||
@@ -102,7 +102,10 @@ def on_post_delete_refresh_org_resource_statistics_cache(sender, instance, **kwa
|
|||||||
|
|
||||||
|
|
||||||
def _refresh_session_org_resource_statistics_cache(instance: Session):
|
def _refresh_session_org_resource_statistics_cache(instance: Session):
|
||||||
cache_field_name = ['total_count_online_users', 'total_count_online_sessions', 'total_count_today_failed_sessions']
|
cache_field_name = [
|
||||||
|
'total_count_online_users', 'total_count_online_sessions',
|
||||||
|
'total_count_today_active_assets','total_count_today_failed_sessions'
|
||||||
|
]
|
||||||
|
|
||||||
org_cache = OrgResourceStatisticsCache(instance.org)
|
org_cache = OrgResourceStatisticsCache(instance.org)
|
||||||
org_cache.expire(*cache_field_name)
|
org_cache.expire(*cache_field_name)
|
||||||
|
|||||||
@@ -30,6 +30,12 @@ class BaseUserPermedAssetsApi(SelfOrPKUserMixin, ListAPIView):
|
|||||||
filterset_class = AssetFilterSet
|
filterset_class = AssetFilterSet
|
||||||
serializer_class = serializers.AssetPermedSerializer
|
serializer_class = serializers.AssetPermedSerializer
|
||||||
|
|
||||||
|
def get_serializer_class(self):
|
||||||
|
serializer_class = super().get_serializer_class()
|
||||||
|
if self.request.query_params.get('id'):
|
||||||
|
serializer_class = serializers.AssetPermedDetailSerializer
|
||||||
|
return serializer_class
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
if getattr(self, 'swagger_fake_view', False):
|
if getattr(self, 'swagger_fake_view', False):
|
||||||
return Asset.objects.none()
|
return Asset.objects.none()
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from perms.serializers.permission import ActionChoicesField
|
|||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'NodePermedSerializer', 'AssetPermedSerializer',
|
'NodePermedSerializer', 'AssetPermedSerializer',
|
||||||
'AccountsPermedSerializer'
|
'AssetPermedDetailSerializer', 'AccountsPermedSerializer'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -46,6 +46,12 @@ class AssetPermedSerializer(OrgResourceModelSerializerMixin):
|
|||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
|
|
||||||
|
class AssetPermedDetailSerializer(AssetPermedSerializer):
|
||||||
|
class Meta(AssetPermedSerializer.Meta):
|
||||||
|
fields = AssetPermedSerializer.Meta.fields + ['spec_info']
|
||||||
|
read_only_fields = fields
|
||||||
|
|
||||||
|
|
||||||
class NodePermedSerializer(serializers.ModelSerializer):
|
class NodePermedSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Node
|
model = Node
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
|
from orgs.utils import tmp_to_org
|
||||||
from accounts.models import Account
|
from accounts.models import Account
|
||||||
from accounts.const import AliasAccount
|
from accounts.const import AliasAccount
|
||||||
from .permission import AssetPermissionUtil
|
from .permission import AssetPermissionUtil
|
||||||
@@ -16,10 +17,11 @@ class PermAccountUtil(AssetPermissionUtil):
|
|||||||
:param asset: Asset
|
:param asset: Asset
|
||||||
:param account_name: 可能是 @USER @INPUT 字符串
|
:param account_name: 可能是 @USER @INPUT 字符串
|
||||||
"""
|
"""
|
||||||
permed_accounts = self.get_permed_accounts_for_user(user, asset)
|
with tmp_to_org(asset.org):
|
||||||
accounts_mapper = {account.alias: account for account in permed_accounts}
|
permed_accounts = self.get_permed_accounts_for_user(user, asset)
|
||||||
account = accounts_mapper.get(account_name)
|
accounts_mapper = {account.alias: account for account in permed_accounts}
|
||||||
return account
|
account = accounts_mapper.get(account_name)
|
||||||
|
return account
|
||||||
|
|
||||||
def get_permed_accounts_for_user(self, user, asset):
|
def get_permed_accounts_for_user(self, user, asset):
|
||||||
""" 获取授权给用户某个资产的账号 """
|
""" 获取授权给用户某个资产的账号 """
|
||||||
|
|||||||
@@ -18,14 +18,19 @@ user_perms = (
|
|||||||
('assets', 'asset', 'match', 'asset'),
|
('assets', 'asset', 'match', 'asset'),
|
||||||
('assets', 'systemuser', 'match', 'systemuser'),
|
('assets', 'systemuser', 'match', 'systemuser'),
|
||||||
('assets', 'node', 'match', 'node'),
|
('assets', 'node', 'match', 'node'),
|
||||||
|
("ops", "adhoc", "*", "*"),
|
||||||
|
("ops", "playbook", "*", "*"),
|
||||||
|
("ops", "job", "*", "*"),
|
||||||
|
("ops", "jobexecution", "*", "*"),
|
||||||
|
("ops", "celerytaskexecution", "view", "*"),
|
||||||
)
|
)
|
||||||
|
|
||||||
system_user_perms = (
|
system_user_perms = (
|
||||||
('authentication', 'connectiontoken', 'add,change,view', 'connectiontoken'),
|
('authentication', 'connectiontoken', 'add,change,view', 'connectiontoken'),
|
||||||
('authentication', 'temptoken', 'add,change,view', 'temptoken'),
|
('authentication', 'temptoken', 'add,change,view', 'temptoken'),
|
||||||
('authentication', 'accesskey', '*', '*'),
|
('authentication', 'accesskey', '*', '*'),
|
||||||
('tickets', 'ticket', 'view', 'ticket'),
|
('tickets', 'ticket', 'view', 'ticket'),
|
||||||
) + user_perms + _view_all_joined_org_perms
|
) + user_perms + _view_all_joined_org_perms
|
||||||
|
|
||||||
_auditor_perms = (
|
_auditor_perms = (
|
||||||
('rbac', 'menupermission', 'view', 'audit'),
|
('rbac', 'menupermission', 'view', 'audit'),
|
||||||
@@ -41,7 +46,6 @@ auditor_perms = user_perms + _auditor_perms
|
|||||||
|
|
||||||
system_auditor_perms = system_user_perms + _auditor_perms + _view_root_perms
|
system_auditor_perms = system_user_perms + _auditor_perms + _view_root_perms
|
||||||
|
|
||||||
|
|
||||||
app_exclude_perms = [
|
app_exclude_perms = [
|
||||||
('users', 'user', 'add,delete', 'user'),
|
('users', 'user', 'add,delete', 'user'),
|
||||||
('orgs', 'org', 'add,delete,change', 'org'),
|
('orgs', 'org', 'add,delete,change', 'org'),
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ only_system_permissions = (
|
|||||||
('xpack', 'license', '*', '*'),
|
('xpack', 'license', '*', '*'),
|
||||||
('settings', 'setting', '*', '*'),
|
('settings', 'setting', '*', '*'),
|
||||||
('tickets', '*', '*', '*'),
|
('tickets', '*', '*', '*'),
|
||||||
('ops', 'task', 'view', 'taskmonitor'),
|
('ops', 'celerytask', 'view', 'taskmonitor'),
|
||||||
('terminal', 'terminal', '*', '*'),
|
('terminal', 'terminal', '*', '*'),
|
||||||
('terminal', 'commandstorage', '*', '*'),
|
('terminal', 'commandstorage', '*', '*'),
|
||||||
('terminal', 'replaystorage', '*', '*'),
|
('terminal', 'replaystorage', '*', '*'),
|
||||||
|
|||||||
@@ -97,13 +97,13 @@ class RBACPermission(permissions.DjangoModelPermissions):
|
|||||||
else:
|
else:
|
||||||
model_cls = queryset.model
|
model_cls = queryset.model
|
||||||
except AssertionError as e:
|
except AssertionError as e:
|
||||||
logger.error(f'Error get model cls: {e}')
|
# logger.error(f'Error get model cls: {e}')
|
||||||
model_cls = None
|
model_cls = None
|
||||||
except AttributeError as e:
|
except AttributeError as e:
|
||||||
logger.error(f'Error get model cls: {e}')
|
# logger.error(f'Error get model cls: {e}')
|
||||||
model_cls = None
|
model_cls = None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error('Error get model class: {} of {}'.format(e, view))
|
# logger.error('Error get model class: {} of {}'.format(e, view))
|
||||||
raise e
|
raise e
|
||||||
return model_cls
|
return model_cls
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class MailTestingAPI(APIView):
|
|||||||
# if k.startswith('EMAIL'):
|
# if k.startswith('EMAIL'):
|
||||||
# setattr(settings, k, v)
|
# setattr(settings, k, v)
|
||||||
try:
|
try:
|
||||||
subject = settings.EMAIL_SUBJECT_PREFIX + "Test"
|
subject = settings.EMAIL_SUBJECT_PREFIX or '' + "Test"
|
||||||
message = "Test smtp setting"
|
message = "Test smtp setting"
|
||||||
email_from = email_from or email_host_user
|
email_from = email_from or email_host_user
|
||||||
email_recipient = email_recipient or email_from
|
email_recipient = email_recipient or email_from
|
||||||
|
|||||||
@@ -17,17 +17,17 @@ class WebMethod(TextChoices):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_methods(cls):
|
def get_methods(cls):
|
||||||
return {
|
methods = {
|
||||||
Protocol.ssh: [cls.web_cli, cls.web_sftp],
|
Protocol.ssh: [cls.web_cli, cls.web_sftp],
|
||||||
Protocol.telnet: [cls.web_cli],
|
Protocol.telnet: [cls.web_cli],
|
||||||
Protocol.rdp: [cls.web_gui],
|
Protocol.rdp: [cls.web_gui],
|
||||||
Protocol.vnc: [cls.web_gui],
|
Protocol.vnc: [cls.web_gui],
|
||||||
|
|
||||||
Protocol.mysql: [cls.web_cli, cls.web_gui],
|
Protocol.mysql: [cls.web_cli],
|
||||||
Protocol.mariadb: [cls.web_cli, cls.web_gui],
|
Protocol.mariadb: [cls.web_cli],
|
||||||
Protocol.oracle: [cls.web_cli, cls.web_gui],
|
Protocol.oracle: [cls.web_cli],
|
||||||
Protocol.postgresql: [cls.web_cli, cls.web_gui],
|
Protocol.postgresql: [cls.web_cli],
|
||||||
Protocol.sqlserver: [cls.web_cli, cls.web_gui],
|
Protocol.sqlserver: [cls.web_cli],
|
||||||
Protocol.redis: [cls.web_cli],
|
Protocol.redis: [cls.web_cli],
|
||||||
Protocol.mongodb: [cls.web_cli],
|
Protocol.mongodb: [cls.web_cli],
|
||||||
Protocol.clickhouse: [cls.web_cli],
|
Protocol.clickhouse: [cls.web_cli],
|
||||||
@@ -35,6 +35,13 @@ class WebMethod(TextChoices):
|
|||||||
Protocol.k8s: [cls.web_cli],
|
Protocol.k8s: [cls.web_cli],
|
||||||
Protocol.http: []
|
Protocol.http: []
|
||||||
}
|
}
|
||||||
|
if not settings.XPACK_ENABLED:
|
||||||
|
return methods
|
||||||
|
|
||||||
|
web_gui_dbs = [Protocol.mysql, Protocol.mariadb, Protocol.oracle, Protocol.postgresql]
|
||||||
|
for db in web_gui_dbs:
|
||||||
|
methods[db].append(cls.web_gui)
|
||||||
|
return methods
|
||||||
|
|
||||||
|
|
||||||
class NativeClient(TextChoices):
|
class NativeClient(TextChoices):
|
||||||
@@ -130,8 +137,6 @@ class AppletMethod:
|
|||||||
from .models import Applet, AppletHost
|
from .models import Applet, AppletHost
|
||||||
|
|
||||||
methods = defaultdict(list)
|
methods = defaultdict(list)
|
||||||
if not settings.XPACK_ENABLED:
|
|
||||||
return methods
|
|
||||||
|
|
||||||
has_applet_hosts = AppletHost.objects.all().exists()
|
has_applet_hosts = AppletHost.objects.all().exists()
|
||||||
applets = Applet.objects.filter(is_active=True)
|
applets = Applet.objects.filter(is_active=True)
|
||||||
|
|||||||
@@ -80,14 +80,20 @@ def upload_session_replay_to_external_storage(session_id):
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@shared_task(verbose_name=_('Run applet host deployment'), activity_callback=lambda did: ([did], ))
|
@shared_task(
|
||||||
|
verbose_name=_('Run applet host deployment'),
|
||||||
|
activity_callback=lambda self, did, *args, **kwargs: ([did], )
|
||||||
|
)
|
||||||
def run_applet_host_deployment(did):
|
def run_applet_host_deployment(did):
|
||||||
with tmp_to_builtin_org(system=1):
|
with tmp_to_builtin_org(system=1):
|
||||||
deployment = AppletHostDeployment.objects.get(id=did)
|
deployment = AppletHostDeployment.objects.get(id=did)
|
||||||
deployment.start()
|
deployment.start()
|
||||||
|
|
||||||
|
|
||||||
@shared_task(verbose_name=_('Install applet'), activity_callback=lambda did, applet_id: ([did],))
|
@shared_task(
|
||||||
|
verbose_name=_('Install applet'),
|
||||||
|
activity_callback=lambda self, did, applet_id, *args, **kwargs: ([did],)
|
||||||
|
)
|
||||||
def run_applet_host_deployment_install_applet(did, applet_id):
|
def run_applet_host_deployment_install_applet(did, applet_id):
|
||||||
with tmp_to_builtin_org(system=1):
|
with tmp_to_builtin_org(system=1):
|
||||||
deployment = AppletHostDeployment.objects.get(id=did)
|
deployment = AppletHostDeployment.objects.get(id=did)
|
||||||
|
|||||||
Reference in New Issue
Block a user