workspace

package
v1.3.24 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	File    *SharedFile
	Entries map[string]*GroupEntry
}

Group describes an /etc/group style file.

func OpenGroup

func OpenGroup(file string) (*Group, error)

OpenGroup - open the group file.

func (*Group) AddAllToGroup

func (g *Group) AddAllToGroup(group, passwdpath string) error

AddAllToGroup adds all accounts in the passwd given to the group given in the etc/group file specified.

func (*Group) AddEntry

func (g *Group) AddEntry(e *GroupEntry)

AddEntry will add or overwrite an existing entry to the Group

func (*Group) AddUser

func (g *Group) AddUser(group, user string) error

AddUser adds the given user to an exising group.

func (*Group) Close

func (g *Group) Close()

Close - close the group file.

func (*Group) GetEntry

func (g *Group) GetEntry(name string) (*GroupEntry, error)

GetEntry retrives a group entry by name.

func (*Group) Merge

func (g *Group) Merge(other *Group) error

Merge two Groups. The passed in takes precedence when there is a clash.

func (*Group) String

func (g *Group) String() string

func (*Group) Write

func (g *Group) Write() error

type GroupEntry

type GroupEntry struct {
	Name  string
	Id    int
	Users []string
}

GroupEntry describes an entry in a group file.

func (*GroupEntry) Merge

func (ge *GroupEntry) Merge(b *GroupEntry) error

Merge two group entries. The passed in entry takes precedence if there is a clash. Names must match though.

func (*GroupEntry) Write

func (e *GroupEntry) Write() string

type Passwd

type Passwd struct {
	File    *SharedFile
	Entries map[string]PasswdEntry
}

func OpenPasswd

func OpenPasswd(file string) (*Passwd, error)

func (*Passwd) Add

func (p *Passwd) Add(e *PasswdEntry) error

Add a passwd entry to the passwd file.

func (*Passwd) Close

func (p *Passwd) Close()

func (*Passwd) Contains

func (p *Passwd) Contains(pe *PasswdEntry) bool

Contains returns true if the passed entry is in the Passwd file.

func (*Passwd) Merge

func (p *Passwd) Merge(other *Passwd) error

Merge - merge the passwd entries in other into p.

func (*Passwd) String

func (p *Passwd) String() string

func (*Passwd) Write

func (p *Passwd) Write() error

type PasswdEntry

type PasswdEntry struct {
	Username string
	Uid      int
	Gid      int
	Shell    string
}

func (*PasswdEntry) Equals

func (pe *PasswdEntry) Equals(other *PasswdEntry) bool

func (*PasswdEntry) Write

func (e *PasswdEntry) Write() string

type SharedFile

type SharedFile struct {
	Path string
	// contains filtered or unexported fields
}

func SharedOpen

func SharedOpen(path string) (*SharedFile, error)

func (*SharedFile) Close

func (sf *SharedFile) Close()

Jump to

Keyboard shortcuts

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