perf: 修复一把数据 (#7789)

* fix: 优化 perm exclude

* perf: 修复一把数据

perf: 修复一些数据

Co-authored-by: ibuler <ibuler@qq.com>
pull/7791/head
fit2bot 2022-03-10 17:40:31 +08:00 committed by GitHub
parent 64e0860d24
commit 29b9adb684
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 32 additions and 11 deletions

View File

@ -3,6 +3,12 @@
from django.db import migrations
def drop_old_permissions(apps, schema_editor):
content_type_model = apps.get_model("rbac", "ContentType")
db_alias = schema_editor.connection.alias
content_type_model.objects.using(db_alias).filter(platform__startswith='Win').update(protocol='rdp')
class Migration(migrations.Migration):
dependencies = [

View File

@ -119,7 +119,8 @@ class AppAccountSerializer(AppSerializerMixin, AuthSerializerMixin, BulkOrgResou
'username': {'default': '', 'required': False},
'password': {'write_only': True},
'app_display': {'label': _('Application display')},
'systemuser_display': {'label': _('System User')}
'systemuser_display': {'label': _('System User')},
'account': {'label': _('account')}
}
use_model_bulk_create = True
model_bulk_create_kwargs = {

View File

@ -6,6 +6,7 @@ from .. import const
from .base import INSTALLED_APPS, TEMPLATES
XPACK_DIR = os.path.join(const.BASE_DIR, 'xpack')
# XPACK_ENABLED = False
XPACK_ENABLED = os.path.isdir(XPACK_DIR)
XPACK_TEMPLATES_DIR = []
XPACK_CONTEXT_PROCESSOR = []

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2f386ac5fff4a8cb0aeb156601148716981c2bbbb14b9162955b3d0dc95da70d
size 107823
oid sha256:4503a69c7536bf3ae9c6ad4c7ec5e5ad48e3a1672239b8ccdb7b100cb79860c1
size 107862

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: JumpServer 0.3.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-03-10 15:35+0800\n"
"POT-Creation-Date: 2022-03-10 10:33+0800\n"
"PO-Revision-Date: 2021-05-20 10:54+0800\n"
"Last-Translator: ibuler <ibuler@qq.com>\n"
"Language-Team: JumpServer team<ibuler@qq.com>\n"
@ -129,7 +129,7 @@ msgstr "登录访问控制"
#: acls/models/login_asset_acl.py:21
#: applications/serializers/application.py:122
#: applications/serializers/application.py:166
#: applications/serializers/application.py:167
msgid "System User"
msgstr "系统用户"
@ -397,10 +397,14 @@ msgid "Date updated"
msgstr "更新日期"
#: applications/serializers/application.py:121
#: applications/serializers/application.py:165
#: applications/serializers/application.py:166
msgid "Application display"
msgstr "应用名称"
#: applications/serializers/application.py:123
msgid "account"
msgstr "账号"
#: applications/serializers/attrs/application_category/cloud.py:8
#: assets/models/cluster.py:40
msgid "Cluster"

View File

@ -26,6 +26,9 @@ user_perms = (
('rbac', 'menupermission', 'view', 'filemanager'),
('perms', 'permedasset', 'view,connect', 'myassets'),
('perms', 'permedapplication', 'view,connect', 'myapps'),
('perms', 'permedkubernetesapp', 'view,connect', 'mykubernetesapp'),
('perms', 'permedremoteApp', 'view,connect', 'myremoteapp'),
('perms', 'permeddatabaseapp', 'view,connect', 'mydatabaseapp'),
('assets', 'asset', 'match', 'asset'),
('assets', 'systemuser', 'match', 'systemuser'),
('assets', 'node', 'match', 'node'),

View File

@ -26,9 +26,6 @@ exclude_permissions = (
('users', 'userpasswordhistory', '*', '*'),
('applications', 'applicationuser', '*', '*'),
('applications', 'historicalaccount', '*', '*'),
('applications', 'databaseapp', '*', '*'),
('applications', 'k8sapp', '*', '*'),
('applications', 'remoteapp', '*', '*'),
('assets', 'adminuser', '*', '*'),
('assets', 'assetgroup', '*', '*'),
('assets', 'cluster', '*', '*'),

View File

@ -8,6 +8,7 @@ def delete_unused_permissions(apps, schema_editor):
content_type_model = apps.get_model('rbac', 'ContentType')
content_type_delete_required = [
('common', 'permission'),
('applications', 'k8sapp'),
]
for app, model in content_type_delete_required:
content_type_model.objects.filter(app_label=app, model=model).delete()

View File

@ -72,7 +72,7 @@ special_pid_mapper = {
'xpack.applicationchangeauthplanexecution': 'app_change_plan_node',
'xpack.applicationchangeauthplantask': 'app_change_plan_node',
'xpack.changeauthplan': 'asset_change_plan_node',
'xpack.changeauthplanexecution': 'asset_change_plan_node',
'xpack.changeauthplanexecution': 'gather_account_node',
'xpack.changeauthplantask': 'asset_change_plan_node',
"assets.gathereduser": "gather_account_node",
'xpack.gatherusertask': 'gather_account_node',
@ -91,6 +91,12 @@ special_pid_mapper = {
'perms.view_myapps': 'my_apps',
'perms.connect_myapps': 'my_apps',
'ops.commandexecution': 'view_workspace',
"perms.view_mykubernetsapp": "my_apps",
"perms.connect_mykubernetsapp": "my_apps",
"perms.view_myremoteapp": "my_apps",
"perms.connect_myremoteapp": "my_apps",
"perms.view_mydatabaseapp": "my_apps",
"perms.connect_mydatabaseapp": "my_apps",
}
verbose_name_mapper = {
@ -100,7 +106,9 @@ verbose_name_mapper = {
}
xpack_nodes = [
'xpack', 'tickets',
'xpack', 'tickets', 'applications.remoteapp',
"assets.accountbackupplan", "assets.accountbackupplanexecution",
"rbac.orgrole", "rbac.orgrolebinding",
]