diff --git a/dbm-ui/backend/flow/engine/bamboo/scene/mysql/common/common_sub_flow.py b/dbm-ui/backend/flow/engine/bamboo/scene/mysql/common/common_sub_flow.py index a80e39f3b6..eb5fc51ef2 100644 --- a/dbm-ui/backend/flow/engine/bamboo/scene/mysql/common/common_sub_flow.py +++ b/dbm-ui/backend/flow/engine/bamboo/scene/mysql/common/common_sub_flow.py @@ -950,4 +950,4 @@ def authorize_sub_flow(root_id: str, uid: str, bk_biz_id: int, operator: str, ru } act_lists.append(act) sub_pipeline.add_parallel_acts(acts_list=act_lists) - return sub_pipeline.build_sub_process(sub_name=_("权限克隆")) + return sub_pipeline.build_sub_process(sub_name=_("授权执行")) diff --git a/dbm-ui/backend/flow/plugins/components/collections/mysql/authorize_rules.py b/dbm-ui/backend/flow/plugins/components/collections/mysql/authorize_rules.py index 7772fc708c..9a21243db5 100644 --- a/dbm-ui/backend/flow/plugins/components/collections/mysql/authorize_rules.py +++ b/dbm-ui/backend/flow/plugins/components/collections/mysql/authorize_rules.py @@ -24,7 +24,6 @@ from backend.db_services.dbpermission.db_authorize.models import DBRuleActionLog from backend.flow.engine.bamboo.engine import BambooEngine from backend.flow.plugins.components.collections.common.base_service import BaseService -from backend.ticket.constants import TicketType logger = logging.getLogger("flow") @@ -88,12 +87,12 @@ def _execute(self, data, parent_data, callback=None) -> bool: ticket_id = kwargs["uid"] bk_biz_id = kwargs["bk_biz_id"] # TODO: 参数兼容,后续去掉 - db_type = kwargs.get("db_type") or TicketType.get_db_type_by_ticket(kwargs["ticket_type"]) + db_type = kwargs.get("db_type") user_db_rules_map = kwargs.get("user_db_rules_map") - operator = kwargs.get("operator") or kwargs.get("created_by") + operator = kwargs.get("operator") # authorize_data, 格式为: # {"user": xx, "source_ip": [...], "target_instances": [...], "access_db": [...]} - authorize_data = kwargs.get("authorize_data") or kwargs["rules_set"][0] + authorize_data = kwargs.get("authorize_data") # 授权规则记录 self._generate_rule_logs(bk_biz_id, db_type, operator, authorize_data, user_db_rules_map) diff --git a/dbm-ui/backend/tests/mock_data/ticket/ticket_params_data.py b/dbm-ui/backend/tests/mock_data/ticket/ticket_params_data.py index 478e66b147..0529f21efe 100644 --- a/dbm-ui/backend/tests/mock_data/ticket/ticket_params_data.py +++ b/dbm-ui/backend/tests/mock_data/ticket/ticket_params_data.py @@ -8,11 +8,13 @@ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ +from backend.configuration.constants import DBType from backend.db_services.mysql.permission.constants import CloneClusterType from backend.ticket.constants import TicketType BASE_FLOW_PARAMS = { "uid": 1, + "root_id": "4146d614abf011", "ticket_type": "", "created_by": "admin", "bk_biz_id": 1, @@ -20,19 +22,19 @@ MYSQL_AUTHORIZE_FLOW_PARAMS = { **BASE_FLOW_PARAMS, + "db_type": DBType.MySQL.value, "ticket_type": TicketType.MYSQL_AUTHORIZE_RULES.value, - "rules_set": [ - { - "bk_biz_id": 1, - "operator": "admin", - "user": "admin", - "access_dbs": ["datamain"], - "account_rules": [{"dbname": "datamain", "bk_biz_id": 1}], - "source_ips": ["127.0.0.1", "127.0.0.2"], - "target_instances": ["gamedb.privtest55.blueking.db"], - "cluster_type": "tendbha", - } - ], + "operator": "admin", + "authorize_data": { + "bk_biz_id": 1, + "operator": "admin", + "user": "admin", + "access_dbs": ["datamain"], + "account_rules": [{"dbname": "datamain", "bk_biz_id": 1}], + "source_ips": ["127.0.0.1", "127.0.0.2"], + "target_instances": ["gamedb.privtest55.blueking.db"], + "cluster_type": "tendbha", + }, } MYSQL_CLONE_FLOW_PARAMS = {