代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/kiran-menu 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 40e7e134d87727cb651e9d290a852bd9ef95b826 Mon Sep 17 00:00:00 2001
From: tangjie02 <tangjie02@kylinsec.com.cn>
Date: Mon, 18 Jul 2022 16:20:26 +0800
Subject: [PATCH] fix(menu): Fix the switch user error by xdmcp logging.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复通过xdmcp远程登录后切换用户错误问题
Closes #57865
Signed-off-by: tangjie02 <tangjie02@kylinsec.com.cn>
---
src/common/kiran-power.cpp | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/src/common/kiran-power.cpp b/src/common/kiran-power.cpp
index c7f1011..9ef8a2c 100644
--- a/src/common/kiran-power.cpp
+++ b/src/common/kiran-power.cpp
@@ -68,11 +68,18 @@ KiranPower::KiranPower()
SESSION_MANAGER_PATH,
SESSION_MANAGER_INTERFACE);
- // TODO: 这里直接选用seat0是有问题的,需要获取会话所在seat
- this->seat_manager_proxy_ = Gio::DBus::Proxy::create_for_bus_sync(Gio::DBus::BUS_TYPE_SYSTEM,
- DISPLAY_MANAGER_DBUS,
- DISPLAY_MANAGER_SEAT_PATH,
- DISPLAY_MANAGER_INTERFACE);
+ auto xdg_seat_object_path = Glib::getenv("XDG_SEAT_PATH");
+ if (!xdg_seat_object_path.empty())
+ {
+ this->seat_manager_proxy_ = Gio::DBus::Proxy::create_for_bus_sync(Gio::DBus::BUS_TYPE_SYSTEM,
+ DISPLAY_MANAGER_DBUS,
+ xdg_seat_object_path,
+ DISPLAY_MANAGER_INTERFACE);
+ }
+ else
+ {
+ KLOG_WARNING("Failed to get environment variable XDG_SEAT_PATH.");
+ }
}
catch (const Gio::DBus::Error &e)
{
@@ -359,6 +366,17 @@ bool KiranPower::can_logout()
bool KiranPower::can_switch_user()
{
RETURN_VAL_IF_TRUE(this->settings_->get_boolean(STARTMENU_LOCKDOWN_KEY_DISABLE_USER_SWITCHING), false);
+
+ try
+ {
+ Glib::VariantBase variant_value;
+ this->seat_manager_proxy_->get_cached_property(variant_value, "CanSwitch");
+ return Glib::VariantBase::cast_dynamic<Glib::Variant<bool>>(variant_value).get();
+ }
+ catch (const Glib::Error &e)
+ {
+ KLOG_WARNING("%s", e.what().c_str());
+ }
return true;
}
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。