accounts

package
v0.0.0-...-14f7cec Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2019 License: Apache-2.0 Imports: 1 Imported by: 6

Documentation

Overview

Package accounts provides an interface, structs, and errors needed for providing User and Group account information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GIDNotFound

func GIDNotFound(gid uint32) error

GIDNotFound returns a NotFoundError for a missing group searched by GID.

func GroupNameNotFound

func GroupNameNotFound(name string) error

GroupNameNotFound returns a NotFoundError for a missing group searched by name.

func UIDNotFound

func UIDNotFound(uid uint32) error

UIDNotFound returns a NotFoundError for a missing user searched by UID.

func UsernameNotFound

func UsernameNotFound(name string) error

UsernameNotFound returns a NotFoundError for a missing user searched by name.

Types

type AccountProvider

type AccountProvider interface {
	// UserByName fetches information about a user by searching for a
	// username.
	UserByName(name string) (*User, error)
	// UserByUID fetches information about a user by searching for a
	// UID.
	UserByUID(uid uint32) (*User, error)
	// Users fetches information about all users known by the
	// AccountProvider.
	Users() ([]*User, error)
	// GroupByName fetches information about a group by searching for a
	// group name.
	GroupByName(name string) (*Group, error)
	// GroupByGID fetches information about a group by searching for a
	// GID.
	GroupByGID(gid uint32) (*Group, error)
	// Groups fetches information about all groups known by the
	// AccountProvider.
	Groups() ([]*Group, error)
	// Names fetches the names of all users and groups known by the
	// AccountProvider.
	Names() ([]string, error)
	// IsName returns whether or not the given name if a valid name of a
	// user/group.
	IsName(name string) (bool, error)
	// AuthorizedKeys returns the authorized SSH keys for the given
	// username.
	AuthorizedKeys(username string) ([]string, error)
}

An AccountProvider provides information about users and groups.

type Group

type Group struct {
	Name    string
	GID     uint32
	Members []string
}

A Group is a Linux group.

type NotFoundError

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

A NotFoundError reports that the user or group that was searched for does not exist.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type User

type User struct {
	Name          string
	UID           uint32
	GID           uint32
	Gecos         string
	HomeDirectory string
	Shell         string
}

A User is a Linux user account.

Jump to

Keyboard shortcuts

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