Documentation
¶
Index ¶
- Variables
- type Group
- type ModGroupOptions
- type Preparer
- type State
- type System
- func (s *System) AddGroup(groupName, groupID string) error
- func (s *System) DelGroup(groupName string) error
- func (s *System) LookupGroup(groupName string) (*user.Group, error)
- func (s *System) LookupGroupID(groupID string) (*user.Group, error)
- func (s *System) ModGroup(groupName string, options *ModGroupOptions) error
- type SystemUtils
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUnsupported = fmt.Errorf("group: not supported on this system")
ErrUnsupported is used when a system is not supported
Functions ¶
This section is empty.
Types ¶
type Group ¶
type Group struct {
// the configured group ID
GID string `export:"gid"`
// the configured group name
Name string `export:"name"`
// the desired group name
NewName string `export:"newname"`
// the group state
State State `export:"state"`
// contains filtered or unexported fields
}
Group manages user groups
func NewGroup ¶
func NewGroup(system SystemUtils) *Group
NewGroup constructs and returns a new Group
type ModGroupOptions ¶
ModGroupOptions are the options specified in the configuration to be used when modifying a group
func SetModGroupOptions ¶
func SetModGroupOptions(g *Group) *ModGroupOptions
SetModGroupOptions returns a ModGroupOptions struct with the options specified in the configuration for modifying a group
type Preparer ¶
type Preparer struct {
// Gid is the group gid.
GID *uint32 `hcl:"gid"`
// Name is the group name.
Name string `hcl:"name" required:"true" nonempty:"true"`
// NewName is used when modifying a group.
// The group Name will be changed to NewName.
NewName string `hcl:"new_name" nonempty:"true"`
// State is whether the group should be present.
// The default value is present.
State State `hcl:"state" valid_values:"present,absent"`
}
Preparer for Group
Group renders group data
type System ¶
type System struct{}
System implements SystemUtils
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 {
AddGroup(groupName, groupID string) error
DelGroup(groupName string) error
ModGroup(groupName string, options *ModGroupOptions) error
LookupGroup(groupName string) (*user.Group, error)
LookupGroupID(groupID string) (*user.Group, error)
}
SystemUtils provides system utilities for group
Click to show internal directories.
Click to hide internal directories.