diff --git a/shell/Commands/User/UserCommand.cs b/shell/Commands/User/UserCommand.cs index 311c266..060842f 100644 --- a/shell/Commands/User/UserCommand.cs +++ b/shell/Commands/User/UserCommand.cs @@ -4,8 +4,21 @@ namespace CMLeonOS.Commands.User { public static class UserCommand { + private static CMLeonOS.UserSystem userSystem; + + public static void SetUserSystem(CMLeonOS.UserSystem system) + { + userSystem = system; + } + public static void ProcessUserCommand(string args, CMLeonOS.UserSystem userSystem, Action showError) { + if (userSystem == null || userSystem.CurrentLoggedInUser == null || !userSystem.CurrentLoggedInUser.IsAdmin) + { + showError("Error: Only administrators can use the user command."); + return; + } + if (string.IsNullOrEmpty(args)) { showError("Error: Please specify a user command"); diff --git a/shell/Shell.cs b/shell/Shell.cs index dada5bb..d587d33 100644 --- a/shell/Shell.cs +++ b/shell/Shell.cs @@ -60,6 +60,7 @@ namespace CMLeonOS Commands.AliasCommand.LoadAliases(); Commands.SettingsCommand.SetUserSystem(userSystem); + Commands.User.UserCommand.SetUserSystem(userSystem); User currentUser = userSystem.CurrentLoggedInUser; if (currentUser != null && !string.IsNullOrWhiteSpace(currentUser.Username))