diff --git a/.gtmproject.yaml b/.gtmproject.yaml index 2cc885e9a7..daf3e196ad 100644 --- a/.gtmproject.yaml +++ b/.gtmproject.yaml @@ -12,7 +12,7 @@ project: # 主分支 default_branch: "master" # 默认目标分支 - default_target_branch: "v1.3.0" + default_target_branch: "v1.4.0" # 默认单据来源 default_source: "github" # 默认事件类型 diff --git a/dbm-ui/backend/db_services/dbpermission/db_authorize/views.py b/dbm-ui/backend/db_services/dbpermission/db_authorize/views.py index 9290dc7f01..bdbf15e07c 100644 --- a/dbm-ui/backend/db_services/dbpermission/db_authorize/views.py +++ b/dbm-ui/backend/db_services/dbpermission/db_authorize/views.py @@ -29,7 +29,7 @@ PreCheckExcelAuthorizeRulesResponseSerializer, PreCheckExcelAuthorizeRulesSerializer, ) -from backend.iam_app.handlers.drf_perm import DBManageIAMPermission +from backend.iam_app.handlers.drf_perm.base import DBManagePermission SWAGGER_TAG = "db_services/permission/authorize" @@ -41,7 +41,7 @@ class DBAuthorizeViewSet(viewsets.SystemViewSet): excel_authorize_meta = ExcelAuthorizeMeta def _get_custom_permissions(self): - return [DBManageIAMPermission()] + return [DBManagePermission()] def _view_common_handler( self, diff --git a/dbm-ui/backend/db_services/mongodb/permission/db_account/views.py b/dbm-ui/backend/db_services/mongodb/permission/db_account/views.py index 89cb9aec19..78510662bb 100644 --- a/dbm-ui/backend/db_services/mongodb/permission/db_account/views.py +++ b/dbm-ui/backend/db_services/mongodb/permission/db_account/views.py @@ -10,9 +10,9 @@ """ from backend.db_services.dbpermission.db_account.views import BaseDBAccountViewSet -from backend.iam_app.handlers.drf_perm import DBManageIAMPermission +from backend.iam_app.handlers.drf_perm.base import DBManagePermission class DBAccountViewSet(BaseDBAccountViewSet): def _get_custom_permissions(self): - return [DBManageIAMPermission()] + return [DBManagePermission()] diff --git a/dbm-ui/backend/db_services/mongodb/permission/db_authorize/views.py b/dbm-ui/backend/db_services/mongodb/permission/db_authorize/views.py index 1d694981f3..eb4298cf47 100644 --- a/dbm-ui/backend/db_services/mongodb/permission/db_authorize/views.py +++ b/dbm-ui/backend/db_services/mongodb/permission/db_authorize/views.py @@ -24,7 +24,7 @@ MongoDBPreCheckAuthorizeRulesResponseSerializer, MongoDBPreCheckAuthorizeRulesSerializer, ) -from backend.iam_app.handlers.drf_perm import DBManageIAMPermission +from backend.iam_app.handlers.drf_perm.base import DBManagePermission SWAGGER_TAG = "db_services/permission/authorize" @@ -36,7 +36,7 @@ class DBAuthorizeViewSet(BaseDBAuthorizeViewSet): excel_authorize_meta = MongoDBExcelAuthorizeMeta def _get_custom_permissions(self): - return [DBManageIAMPermission()] + return [DBManagePermission()] @common_swagger_auto_schema( operation_summary=_("规则前置检查"), diff --git a/dbm-ui/backend/db_services/mongodb/restore/views.py b/dbm-ui/backend/db_services/mongodb/restore/views.py index 1d5019f83e..b11b6fc971 100644 --- a/dbm-ui/backend/db_services/mongodb/restore/views.py +++ b/dbm-ui/backend/db_services/mongodb/restore/views.py @@ -20,14 +20,14 @@ from backend.db_services.mongodb.restore.constants import BACKUP_LOG_RANGE_DAYS from backend.db_services.mongodb.restore.handlers import MongoDBRestoreHandler from backend.db_services.mongodb.restore.serializers import BackupLogRollbackTimeSerializer -from backend.iam_app.handlers.drf_perm import DBManageIAMPermission +from backend.iam_app.handlers.drf_perm.base import DBManagePermission SWAGGER_TAG = "db_services/mongodb/restore" class MongoDBRestoreViewSet(viewsets.SystemViewSet): def _get_custom_permissions(self): - return [DBManageIAMPermission()] + return [DBManagePermission()] @common_swagger_auto_schema( operation_summary=_("通过日志平台获取集群单据备份记录"), diff --git a/dbm-ui/backend/flow/plugins/components/collections/mongodb/mongo_shutdown_meta.py b/dbm-ui/backend/flow/plugins/components/collections/mongodb/mongo_shutdown_meta.py index ec55a3d9d9..66a037769e 100644 --- a/dbm-ui/backend/flow/plugins/components/collections/mongodb/mongo_shutdown_meta.py +++ b/dbm-ui/backend/flow/plugins/components/collections/mongodb/mongo_shutdown_meta.py @@ -15,6 +15,7 @@ from typing import Dict, List from django.db import transaction +from django.utils.translation import ugettext as _ from pipeline.component_framework.component import Component from pipeline.core.flow.activity import Service @@ -47,7 +48,7 @@ def decommission_proxies(self, cluster: Cluster, proxies: List[Dict]): proxy_objs = common.filter_out_instance_obj(proxies, cluster.proxyinstance_set.all()) _t = common.not_exists(proxies, proxy_objs) if _t: - raise Exception("{} 存在不是本集群的实例下架列表".format(_t)) + raise Exception(_("{} 存在不是本集群的实例下架列表").format(_t)) machine_obj, cc_manage = defaultdict(dict), CcManage(cluster.bk_biz_id) cc_manage.delete_service_instance(bk_instance_ids=[obj.bk_instance_id for obj in proxy_objs]) diff --git a/dbm-ui/backend/tests/db_services/mysql/permission/test_authorize_handler.py b/dbm-ui/backend/tests/db_services/mysql/permission/test_authorize_handler.py index b75960a3c0..8fc56de3c8 100644 --- a/dbm-ui/backend/tests/db_services/mysql/permission/test_authorize_handler.py +++ b/dbm-ui/backend/tests/db_services/mysql/permission/test_authorize_handler.py @@ -16,6 +16,7 @@ import pytest from openpyxl.writer.excel import save_virtual_workbook +from backend.db_meta.enums import ClusterType from backend.db_services.mysql.permission.authorize.dataclass import MySQLAuthorizeMeta, MySQLExcelAuthorizeMeta from backend.db_services.mysql.permission.authorize.handlers import MySQLAuthorizeHandler from backend.db_services.mysql.permission.constants import AUTHORIZE_EXCEL_HEADER @@ -52,7 +53,7 @@ def test_pre_check_excel_rules(self, query_fixture): excel = io.BytesIO(excel_bytes) excel_obj = namedtuple("ExcelObj", ["file"])(file=excel) - excel_authorize = MySQLExcelAuthorizeMeta(authorize_file=excel_obj) + excel_authorize = MySQLExcelAuthorizeMeta(authorize_file=excel_obj, cluster_type=ClusterType.TenDBHA) excel_authorize.authorize_excel_data = ExcelHandler.paser(excel_authorize.authorize_file.file) authorize_data_list = self.handler.pre_check_excel_rules(excel_authorize) diff --git a/dbm-ui/backend/tests/ticket/test_ticket_flow.py b/dbm-ui/backend/tests/ticket/test_ticket_flow.py index 7bc0ac7bb1..89546dcec8 100644 --- a/dbm-ui/backend/tests/ticket/test_ticket_flow.py +++ b/dbm-ui/backend/tests/ticket/test_ticket_flow.py @@ -87,7 +87,7 @@ class TestTicketFlow: @patch("backend.db_services.cmdb.biz.CCApi", CCApiMock()) @patch("backend.db_services.cmdb.biz.Permission", PermissionMock) @patch( - "backend.db_services.mysql.permission.db_account.handlers.MySQLPrivManagerApi.list_account_rules", + "backend.db_services.dbpermission.db_account.handlers.DBPrivManagerApi.list_account_rules", return_value=MYSQL_PERMISSION_ACCOUNT, ) def test_authorize_ticket_flow(