diff --git a/osu.Desktop/Security/ElevatedPrivilegesChecker.cs b/osu.Desktop/Security/ElevatedPrivilegesChecker.cs index 6665733656..0bed9830df 100644 --- a/osu.Desktop/Security/ElevatedPrivilegesChecker.cs +++ b/osu.Desktop/Security/ElevatedPrivilegesChecker.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Security.Principal; using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -21,48 +20,14 @@ namespace osu.Desktop.Security [Resolved] private INotificationOverlay notifications { get; set; } = null!; - private bool elevated; - - [BackgroundDependencyLoader] - private void load() - { - elevated = checkElevated(); - } - protected override void LoadComplete() { base.LoadComplete(); - if (elevated) + if (Environment.IsPrivilegedProcess) notifications.Post(new ElevatedPrivilegesNotification()); } - private bool checkElevated() - { - try - { - switch (RuntimeInfo.OS) - { - case RuntimeInfo.Platform.Windows: - if (!OperatingSystem.IsWindows()) return false; - - var windowsIdentity = WindowsIdentity.GetCurrent(); - var windowsPrincipal = new WindowsPrincipal(windowsIdentity); - - return windowsPrincipal.IsInRole(WindowsBuiltInRole.Administrator); - - case RuntimeInfo.Platform.macOS: - case RuntimeInfo.Platform.Linux: - return Mono.Unix.Native.Syscall.geteuid() == 0; - } - } - catch - { - } - - return false; - } - private partial class ElevatedPrivilegesNotification : SimpleNotification { public override bool IsImportant => true; diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index e7a63bd921..acb53835a3 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -24,7 +24,6 @@ -