privileges

package module
v0.0.0-...-27f1b54 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2016 License: Apache-2.0 Imports: 7 Imported by: 1

README

travis Coverage Status

privileges

A golang package to implement *nix style file permissions including users and groups management.

Documentation

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSalt64

func GenerateSalt64() []byte

func Hash

func Hash(salt, password string) (string, error)

Types

type Privileged

type Privileged interface {
	Rules() *Rules
	Read(...string) interface{}
	Write(...string) interface{}
	Exec(...string) interface{}
}

type Privileges

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

func New

func New(path string) (*Privileges, error)

func (*Privileges) Close

func (p *Privileges) Close()

func (*Privileges) Login

func (p *Privileges) Login(username, password string) (*Session, error)

func (*Privileges) LoginHash

func (p *Privileges) LoginHash(username, hashword string) (*Session, error)

func (*Privileges) Restore

func (p *Privileges) Restore(snapshot []byte) error

func (*Privileges) Snapshot

func (p *Privileges) Snapshot() ([]byte, error)

type Rules

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

func NewRules

func NewRules(owner, group, rules string) (*Rules, error)

func (*Rules) Exec

func (r *Rules) Exec(args ...string) interface{}

func (*Rules) Group

func (r *Rules) Group() string

Group returns a string naming the group identified by the permissions

func (*Rules) Octal

func (r *Rules) Octal() string

Rules returns the octal representation of the file's permissions (0777)

func (*Rules) Owner

func (r *Rules) Owner() string

Owner returns a string naming the user owner identified by the permissions

func (*Rules) Read

func (r *Rules) Read(args ...string) interface{}

func (*Rules) Rules

func (r *Rules) Rules() *Rules

func (*Rules) Symbolic

func (r *Rules) Symbolic(directory bool) string

func (*Rules) Write

func (r *Rules) Write(args ...string) interface{}

type Session

type Session struct {
	SID  string
	User string
	Hash string
	// contains filtered or unexported fields
}

func (*Session) CanChgrp

func (s *Session) CanChgrp(r *Rules, group string) bool

func (*Session) CanChmod

func (s *Session) CanChmod(r *Rules, mode string) bool

func (*Session) CanChown

func (s *Session) CanChown(r *Rules, owner string) bool

func (Session) CanExec

func (s Session) CanExec(p Privileged) bool

func (*Session) CanRead

func (s *Session) CanRead(p Privileged) bool

func (*Session) CanWrite

func (s *Session) CanWrite(p Privileged) bool

func (*Session) ChangePassword

func (s *Session) ChangePassword(username, salt, hashword string) error

func (*Session) DeleteGroup

func (s *Session) DeleteGroup(name string) error

func (*Session) DeleteUser

func (s *Session) DeleteUser(username string) error

func (*Session) Exec

func (s *Session) Exec(p Privileged, args ...string) (interface{}, error)

func (*Session) Gid

func (s *Session) Gid(username, group string) (string, error)

func (*Session) GroupListUsersGids

func (s *Session) GroupListUsersGids(group string) ([]string, error)

func (*Session) ListGroups

func (s *Session) ListGroups() ([]string, error)

func (*Session) ListUsers

func (s *Session) ListUsers() ([]string, error)

func (*Session) Logout

func (s *Session) Logout()

func (*Session) NewGroup

func (s *Session) NewGroup(name string) error

func (*Session) NewUser

func (s *Session) NewUser(username, salt, hashword string) error

func (*Session) Read

func (s *Session) Read(p Privileged, args ...string) (interface{}, error)

func (*Session) Umask

func (s *Session) Umask(mask string) (string, error)

func (*Session) UserAddGroup

func (s *Session) UserAddGroup(username, group string) error

func (*Session) UserInGroup

func (s *Session) UserInGroup(username, group string) (bool, error)

func (*Session) UserListGroups

func (s *Session) UserListGroups(username string) ([]string, error)

func (*Session) UserRemoveGroup

func (s *Session) UserRemoveGroup(username, group string) error

func (*Session) Write

func (s *Session) Write(p Privileged, args ...string) (interface{}, error)

Jump to

Keyboard shortcuts

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