Documentation ¶
Index ¶
- Variables
- type AddUserOptions
- type Preparer
- type State
- type System
- func (s *System) AddUser(userName string, options *AddUserOptions) error
- func (s *System) DelUser(userName string) error
- func (s *System) Lookup(userName string) (*user.User, error)
- func (s *System) LookupGroup(groupName string) (*user.Group, error)
- func (s *System) LookupGroupID(groupID string) (*user.Group, error)
- func (s *System) LookupID(userID string) (*user.User, error)
- type SystemUtils
- type User
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupported = fmt.Errorf("user: not supported on this system")
ErrUnsupported is used when a system is not supported
Functions ¶
This section is empty.
Types ¶
type AddUserOptions ¶
AddUserOptions are the options specified in the configuration to be used when adding a user
func SetAddUserOptions ¶
func SetAddUserOptions(u *User) *AddUserOptions
SetAddUserOptions returns a AddUserOptions struct with the options specified in the configuration for adding a user
type Preparer ¶
type Preparer struct { // Username is the user login name. Username string `hcl:"username" required:"true"` // UID is the user ID. UID *uint32 `hcl:"uid"` // GroupName is the primary group for user and must already exist. // Only one of GID or Groupname may be indicated. GroupName string `hcl:"groupname" mutually_exclusive:"gid,groupname"` // Gid is the primary group ID for user and must refer to an existing group. // Only one of GID or Groupname may be indicated. GID *uint32 `hcl:"gid" mutually_exclusive:"gid,groupname"` // Name is the user description. Name string `hcl:"name"` // HomeDir is the user's login directory. By default, the login // name is appended to the home directory. HomeDir string `hcl:"home_dir"` // State is whether the user should be present. State State `hcl:"state" valid_values:"present,absent"` }
Preparer for User
User renders user data
type System ¶
type System struct{}
System implements SystemUtils
func (*System) AddUser ¶
func (s *System) AddUser(userName string, options *AddUserOptions) error
AddUser adds a user
func (*System) Lookup ¶
Lookup looks up a user by name If the user cannot be found an error is returned
func (*System) LookupGroup ¶
LookupGroup looks up a group by name If the group cannot be found an error is returned
func (*System) LookupGroupID ¶
LookupGroupID looks up a group by gid If the group cannot be found an error is returned
type SystemUtils ¶
type SystemUtils interface { AddUser(userName string, options *AddUserOptions) error DelUser(userName string) error Lookup(userName string) (*user.User, error) LookupID(userID string) (*user.User, error) LookupGroup(groupName string) (*user.Group, error) LookupGroupID(groupID string) (*user.Group, error) }
SystemUtils provides system utilities for user