add a pill to show if a user is admin or not
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
//go:build !windows
|
||||
|
||||
package sysinfo
|
||||
|
||||
import "os"
|
||||
|
||||
// root == admin
|
||||
func IsAdmin() bool {
|
||||
return os.Getuid() == 0
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
//go:build windows
|
||||
|
||||
package sysinfo
|
||||
|
||||
import "golang.org/x/sys/windows"
|
||||
|
||||
// check current process token to see if we're admin asf
|
||||
func IsAdmin() bool {
|
||||
token := windows.GetCurrentProcessToken()
|
||||
return token.IsElevated()
|
||||
}
|
||||
Reference in New Issue
Block a user