Documentation
¶
Index ¶
- Variables
- func CreateTriggerFile() error
- func RemoveTriggerFile() (err error)
- func TriggerFileExists() bool
- type Context
- func (c *Context) AddToGroup(user *User, group string) (ran bool, err error)
- func (c *Context) CreateGroup(name string, id string) error
- func (c *Context) DeleteGroup(name string) error
- func (c *Context) DeleteUser(user *User) (ran bool, err error)
- func (c *Context) FilterUsers(filters ...string) (filtered []User)
- func (c *Context) RemoveFromGroup(user *User, group string) (ran bool, err error)
- func (c *Context) UpdateGroupID(name string, id string) error
- type DeleteUsers
- type Migration
- type RemoveGroup
- type RemoveUsers
- type UpdateGroup
- type UpdateUsers
- type User
Constants ¶
This section is empty.
Variables ¶
var ( // TrackDir is an externally defined location used to store the TriggerFile TrackDir string // SysDir is an externally defined location wherein system migration files are stored SysDir string // UsrDir is an externally defined location wherein user migration files are stored UsrDir string // TriggerFile is the location of the trigger file, which must be present for migration to occur TriggerFile = TrackDir + "/trigger" )
Functions ¶
func CreateTriggerFile ¶
func CreateTriggerFile() error
CreateTriggerFile creates a trigger file at TriggerFile, along with its parent directories if necessary
func RemoveTriggerFile ¶
func RemoveTriggerFile() (err error)
RemoveTriggerFile facilitates the removal of the file at TriggerFile
func TriggerFileExists ¶
func TriggerFileExists() bool
TriggerFileExists is a convenience function to determine if a file exists at TriggerFile
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context contains contextual system data, such as groups, users, and active shells, along with paths to certain binaries
func NewContext ¶
NewContext creates an initialized instance of a Context object
func (*Context) AddToGroup ¶
AddToGroup adds a User to a preexisting group. Returns whether or not the modification ran, along with an error in case something went wrong
func (*Context) CreateGroup ¶
CreateGroup creates a new group with the given name and ID
func (*Context) DeleteGroup ¶ added in v1.0.0
DeleteGroup deletes a preexisting group with the given name
func (*Context) DeleteUser ¶ added in v1.0.0
DeleteUser deletes a preexisting user with the given user
func (*Context) FilterUsers ¶
FilterUsers returns users that fit into one or more of the given filters
func (*Context) RemoveFromGroup ¶ added in v1.0.0
RemoveFromGroup removes a User from a preexisting group. Returns whether or not the modification ran, along with an error in case something went wrong
type DeleteUsers ¶ added in v1.0.0
type DeleteUsers struct {
UserName string `toml:"name"`
}
DeleteUser is a type of modification that attempts to delete a preexisting user from the system
type Migration ¶
type Migration struct { Name string Path string Description string `toml:"description"` UpdateUsers []*UpdateUsers `toml:"users-update"` UpdateGroup []*UpdateGroup `toml:"group-update"` RemoveUsers []*RemoveUsers `toml:"users-remove"` RemoveGroup []*RemoveGroup `toml:"group-delete"` DeleteUsers []*DeleteUsers `toml:"users-delete"` }
Migration contains the information about a migration, including where it is on the system and its requested system modifications
func LoadMigrations ¶
func LoadMigrations() []Migration
LoadMigrations finds migration files in SysDir and UsrDir and attempts to load them
type RemoveGroup ¶ added in v1.0.0
type RemoveGroup struct {
GroupName string `toml:"name"`
}
RemoveGroup is a type of modification that attempts to delete a preexisting group from the given name
type RemoveUsers ¶ added in v1.0.0
RemoveUsers is a type of modification that removes a group from a specific set of users
type UpdateGroup ¶
UpdateGroup is a type of modification that attempts to create or update a group to the given name and ID
type UpdateUsers ¶
UpdateUsers is a type of modification that adds a group to a specific set of users