diff --git a/src/Tgstation.Server.Host/Security/ISystemIdentity.cs b/src/Tgstation.Server.Host/Security/ISystemIdentity.cs index bd63d784de..af3b2a0171 100644 --- a/src/Tgstation.Server.Host/Security/ISystemIdentity.cs +++ b/src/Tgstation.Server.Host/Security/ISystemIdentity.cs @@ -24,6 +24,12 @@ namespace Tgstation.Server.Host.Security /// bool CanCreateSymlinks { get; } + /// + /// Is this identity a SuperUser for the OS. + /// See Administrator on Windows or root on Linux. + /// + bool? IsSuperUser { get; } + /// /// Clone the creating another copy that must have called on it. /// diff --git a/src/Tgstation.Server.Host/Security/PosixSystemIdentity.cs b/src/Tgstation.Server.Host/Security/PosixSystemIdentity.cs index 73a0d36678..ed661f90de 100644 --- a/src/Tgstation.Server.Host/Security/PosixSystemIdentity.cs +++ b/src/Tgstation.Server.Host/Security/PosixSystemIdentity.cs @@ -11,31 +11,8 @@ namespace Tgstation.Server.Host.Security /// sealed class PosixSystemIdentity : ISystemIdentity { - /// - /// True if TGS is running under root. - /// - bool isRoot = false; - - /// - /// True if is populated. - /// - bool isRootChecked = false; - - /// - /// Checks whether TGS is running under the root user. - /// - /// True if running under root. False otherwise. - public bool IsRoot() - { - if (isRootChecked) - { - return isRoot; - } - - isRoot = Syscall.getuid() == 0; - isRootChecked = true; - return isRoot; - } + /// + public bool? IsSuperUser => Syscall.getuid() == 0; /// public string Uid => throw new NotImplementedException(); diff --git a/src/Tgstation.Server.Host/Security/WindowsSystemIdentity.cs b/src/Tgstation.Server.Host/Security/WindowsSystemIdentity.cs index 136c3c24e7..f1c3588b88 100644 --- a/src/Tgstation.Server.Host/Security/WindowsSystemIdentity.cs +++ b/src/Tgstation.Server.Host/Security/WindowsSystemIdentity.cs @@ -24,6 +24,9 @@ namespace Tgstation.Server.Host.Security /// public bool CanCreateSymlinks => canCreateSymlinks ?? throw new NotSupportedException(); + /// + public bool? IsSuperUser => identity?.IsSystem; + /// /// The for the . ///