users

package
v0.0.0-...-e81e7cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2020 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserTypeStandard = iota
	UserTypeAdmin
)
View Source
const (
	// Same as the abbreviation in `passwd --status`
	PasswordStatusUsable     = "P"
	PasswordStatusNoPassword = "NP"
	PasswordStatusLocked     = "L"
)
View Source
const CommentFieldsLen = 5

Variables

This section is empty.

Functions

func AddGroupForUser

func AddGroupForUser(group, user string) error

func CanNoPasswdLogin

func CanNoPasswdLogin(username string) bool

func CreateGuestUser

func CreateGuestUser() (string, error)

func CreateUser

func CreateUser(username, fullname, shell string) error

func DeleteGroupForUser

func DeleteGroupForUser(group, user string) error

func DeleteUser

func DeleteUser(rmFiles bool, username string) error

func EnableNoPasswdLogin

func EnableNoPasswdLogin(username string, enabled bool) error

func EncodePasswd

func EncodePasswd(words string) string

func GetAllGroups

func GetAllGroups() ([]string, error)

func GetAutoLoginUser

func GetAutoLoginUser() (string, error)

GetAutoLoginUser get the autologin user, if no, return empty string

func GetDMConfig

func GetDMConfig() (string, error)

GetDMConfig return the current display manager

func GetDefaultXSession

func GetDefaultXSession() (string, error)

GetDefaultXSession return the default user session

func GetPresetGroups

func GetPresetGroups(userType int) []string

func GetUserGroups

func GetUserGroups(user string) ([]string, error)

func IsAdminUser

func IsAdminUser(username string) bool

func IsAutoLoginUser

func IsAutoLoginUser(username string) bool

func IsPasswordExpired

func IsPasswordExpired(username string) (bool, error)

func LockedUser

func LockedUser(locked bool, username string) error

func ModifyFullName

func ModifyFullName(fullName, username string) error

func ModifyHome

func ModifyHome(dir, username string) error

func ModifyMaxPasswordAge

func ModifyMaxPasswordAge(username string, nDays int) error

func ModifyPasswd

func ModifyPasswd(words, username string) error

func ModifyShell

func ModifyShell(shell, username string) error

func SetAutoLoginUser

func SetAutoLoginUser(username, session string) error

SetAutoLoginUser set the autologin user, if disable autologin, set the 'username' to empty string

func SetGroupsForUser

func SetGroupsForUser(groups []string, user string) error

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

type CacheProviderFn

type CacheProviderFn func(filename string) (interface{}, error)

type CommentInfo

type CommentInfo [CommentFieldsLen]string

CommentInfo is passwd file user comment info

func (*CommentInfo) FullName

func (ci *CommentInfo) FullName() string

func (*CommentInfo) SetFullName

func (ci *CommentInfo) SetFullName(value string)

func (*CommentInfo) String

func (ci *CommentInfo) String() string

type GroupInfo

type GroupInfo struct {
	Name  string
	Gid   string
	Users []string
}

type ShadowInfo

type ShadowInfo struct {
	Name       string
	LastChange int
	MaxDays    int
	Status     string // password status
}

func GetShadowInfo

func GetShadowInfo(username string) (*ShadowInfo, error)

type UserInfo

type UserInfo struct {
	Name string
	Uid  string
	Gid  string

	Home  string
	Shell string
	// contains filtered or unexported fields
}

func GetUserInfoByName

func GetUserInfoByName(name string) (UserInfo, error)

func GetUserInfoByUid

func GetUserInfoByUid(uid string) (UserInfo, error)

func (*UserInfo) Comment

func (u *UserInfo) Comment() *CommentInfo

type UserInfos

type UserInfos []UserInfo

func GetAllUserInfos

func GetAllUserInfos() (UserInfos, error)

func GetHumanUserInfos

func GetHumanUserInfos() (UserInfos, error)

func (UserInfos) GetUserNames

func (infos UserInfos) GetUserNames() []string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL