mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-25 09:01:29 +02:00
37 lines
850 B
Go
37 lines
850 B
Go
//go:build windows
|
|
|
|
package getent
|
|
|
|
import (
|
|
"errors"
|
|
"os/user"
|
|
)
|
|
|
|
// Windows does not use NSS or getent; os/user resolves accounts there
|
|
// without cgo, so everything delegates to it.
|
|
|
|
// LookupUser looks up a user by name.
|
|
func LookupUser(username string) (*user.User, error) {
|
|
return user.Lookup(username)
|
|
}
|
|
|
|
// LookupUserID looks up a user by UID.
|
|
func LookupUserID(uid string) (*user.User, error) {
|
|
return user.LookupId(uid)
|
|
}
|
|
|
|
// CurrentUser returns the user this process runs as.
|
|
func CurrentUser() (*user.User, error) {
|
|
return user.Current()
|
|
}
|
|
|
|
// GroupIDs returns the IDs of the groups the user is a member of.
|
|
func GroupIDs(u *user.User) ([]string, error) {
|
|
return u.GroupIds()
|
|
}
|
|
|
|
// UserShell is unanswerable on Windows, which has no login-shell database.
|
|
func UserShell(string) (string, error) {
|
|
return "", errors.ErrUnsupported
|
|
}
|