DCS/ruiyiweiUX/Assets/Scripts/Services/IAuthenticationService.cs

40 lines
876 B
C#
Raw Permalink Normal View History

2026-06-09 13:59:11 +08:00
using System.Collections.Generic;
public enum UserRole
{
Admin,
User
}
public class CurrentUser
{
public string Username { get; set; }
public UserRole Role { get; set; }
}
/// <summary>
/// 扩展认证服务接口,支持用户管理功能
/// </summary>
public interface IAuthenticationService : IService
{
bool Login(string username, string password, out UserRole role);
void Logout();
bool IsLoggedIn { get; }
string CurrentUsername { get; }
UserRole CurrentRole { get; }
CurrentUser CurrentUser { get; }
// 用户管理功能
bool AddUser(string username, string password, UserRole role);
bool RemoveUser(string username);
bool ChangePassword(string username, string oldPassword, string newPassword);
bool ValidCurrentPassword(string password);
List<UserInfo> GetAllUsers();
// 用户统计信息
int GetUserCount();
int GetMaxUserCount();
}