feat: add Admin user selection dialog (管理员用户选择对话框)
When an Admin user logs in, display a centered dialog allowing them to
select which user identity to use for the session. The Admin adopts the
selected user's permissions and operates as that user throughout the session.
Changes:
- Add UserSelectionDialog class in gui/user_selection_dialog.py
- Add SessionManager.switch_user() method to switch user identity
- Add SessionManager.get_original_admin() method to retrieve original admin
- Update MainWindow status bar to show when Admin operates as another user
- Display format: "当前用户: {username} ({type}) - 以 {admin_username} 身份登录"
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -102,8 +102,17 @@ class MainWindow:
|
||||
|
||||
# 用户信息显示
|
||||
user_type_display = "管理员" if self.session_manager.is_admin() else "用户"
|
||||
original_admin = self.session_manager.get_original_admin()
|
||||
|
||||
if original_admin:
|
||||
# Admin以其他用户身份操作
|
||||
user_info_text = f"当前用户: {self.session_manager.get_username()} ({user_type_display}) - 以 {original_admin['username']} 身份登录"
|
||||
else:
|
||||
# 正常登录
|
||||
user_info_text = f"当前用户: {self.session_manager.get_username()} ({user_type_display})"
|
||||
|
||||
self.user_info_var = tk.StringVar()
|
||||
self.user_info_var.set(f"当前用户: {self.session_manager.get_username()} ({user_type_display})")
|
||||
self.user_info_var.set(user_info_text)
|
||||
user_label = ttk.Label(
|
||||
self.status_bar, textvariable=self.user_info_var, anchor=tk.E
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user