예제 #1
0
파일: user.go 프로젝트: ryancox/goss
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
}
예제 #2
0
파일: user.go 프로젝트: netluxe/goss
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
}
예제 #3
0
파일: user.go 프로젝트: postfix/goss
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),
	}
}