kiran-authentication-service/0006-fix-default-device-Device-adapters-do-not-update-def.patch
liuxinhao 2e5f30a061 更新部分问题:
- 多因子登录禁止跳转登录
- 修复更新默认认证设备的逻辑,更新翻译
- 多因子认证,处理只有密码认证的情况
- 设备适配器不更新不存在的默认设备
2023-06-02 15:21:23 +08:00

44 lines
1.9 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From d5b850a0249c2f2b19341acc5bd3a72eebcfa626 Mon Sep 17 00:00:00 2001
From: liuxinhao <liuxinhao@kylinsec.com.cn>
Date: Fri, 2 Jun 2023 14:46:07 +0800
Subject: [PATCH 6/9] fix(default device): Device adapters do not update
default devices that do not exist
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 设备适配器不更新不存在的默认设备
---
src/daemon/device/device-adaptor-factory.cpp | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/daemon/device/device-adaptor-factory.cpp b/src/daemon/device/device-adaptor-factory.cpp
index d3ffe19..531e0d9 100644
--- a/src/daemon/device/device-adaptor-factory.cpp
+++ b/src/daemon/device/device-adaptor-factory.cpp
@@ -189,11 +189,16 @@ void DeviceAdaptorFactory::onDefaultDeviceChanged(int authType,
const QString &deviceID)
{
auto deviceAdaptor = this->getDeviceAdaptor(authType);
- if (deviceAdaptor && deviceAdaptor->getDeviceID() != deviceID)
- {
- auto dbusDeviceProxy = this->getDBusDeviceProxy(authType, deviceID);
- deviceAdaptor->updateDBusDeviceProxy(dbusDeviceProxy);
- }
+ // 当前不存在设备设配器的情况,不更新设备适配器代理,需要时会优先考虑默认设备
+ // 设备适配器已使用默认设备代理,不需要更新设备适配器
+ RETURN_IF_FALSE(deviceAdaptor && deviceAdaptor->getDeviceID()!=deviceID);
+
+ // 尝试通过默认设备ID拿到设备代理
+ auto recommendedDeviceProxy = this->getDBusDeviceProxy(authType, deviceID);
+ // 未能拿到设备,或者拿不到默认设备,不更新设备适配器代理
+ RETURN_IF_FALSE( recommendedDeviceProxy && recommendedDeviceProxy->deviceID()==deviceID);
+
+ deviceAdaptor->updateDBusDeviceProxy(recommendedDeviceProxy);
}
void DeviceAdaptorFactory::onAuthDeviceManagerLost(const QString &service)
--
2.33.0