mirror of
https://github.com/Leonmmcoset/CMLeonOS.git
synced 2026-03-03 15:30:27 +00:00
增加功能:设置只有管理员才可以设置
This commit is contained in:
@@ -5,6 +5,13 @@ namespace CMLeonOS.Commands
|
||||
{
|
||||
public static class SettingsCommand
|
||||
{
|
||||
private static UserSystem userSystem;
|
||||
|
||||
public static void SetUserSystem(UserSystem system)
|
||||
{
|
||||
userSystem = system;
|
||||
}
|
||||
|
||||
public static void ProcessSettings(string args)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(args))
|
||||
@@ -13,6 +20,12 @@ namespace CMLeonOS.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
if (userSystem == null || userSystem.CurrentLoggedInUser == null || !userSystem.CurrentLoggedInUser.IsAdmin)
|
||||
{
|
||||
Console.WriteLine("Error: Only administrators can change settings.");
|
||||
return;
|
||||
}
|
||||
|
||||
string[] parts = args.Split(new char[] { ' ' }, 2, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (parts.Length == 1)
|
||||
|
||||
Reference in New Issue
Block a user