func NewUser(sysUser system.User, config util.Config) (*User, error) { username := sysUser.Username() exists, _ := sysUser.Exists() u := &User{ Username: username, Exists: exists.(bool), } if !contains(config.IgnoreList, "uid") { uid, _ := sysUser.UID() u.UID = uid.(string) } if !contains(config.IgnoreList, "gid") { gid, _ := sysUser.GID() u.GID = gid.(string) } if !contains(config.IgnoreList, "groups") { groups, _ := sysUser.Groups() u.Groups = groups } if !contains(config.IgnoreList, "home") { home, _ := sysUser.Home() u.Home = home.(string) } return u, nil }
func NewUser(sysUser system.User, ignoreList []string) *User { username := sysUser.Username() exists, _ := sysUser.Exists() u := &User{ Username: username, Exists: exists.(bool), } if !contains(ignoreList, "uid") { uid, _ := sysUser.UID() u.UID = uid.(string) } if !contains(ignoreList, "gid") { gid, _ := sysUser.GID() u.GID = gid.(string) } if !contains(ignoreList, "groups") { groups, _ := sysUser.Groups() u.Groups = groups } if !contains(ignoreList, "home") { home, _ := sysUser.Home() u.Home = home.(string) } return u }
func NewUser(sysUser system.User) *User { username := sysUser.Username() exists, _ := sysUser.Exists() uid, _ := sysUser.UID() gid, _ := sysUser.GID() groups, _ := sysUser.Groups() home, _ := sysUser.Home() return &User{ Username: username, Exists: exists.(bool), UID: uid.(string), GID: gid.(string), Groups: groups, Home: home.(string), } }