user

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicatedUser = errors.New("duplicated user found")
)

Functions

This section is empty.

Types

type DB

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

func NewDB

func NewDB(db *bolt.DB) *DB

func (DB) AddUser

func (u DB) AddUser(user *User) error

func (DB) DeleteUser added in v0.1.1

func (u DB) DeleteUser(id string) error

func (DB) GetAllUsers added in v0.1.1

func (u DB) GetAllUsers() []*User

func (DB) GetUser

func (u DB) GetUser(id string) *User

func (DB) SetUser

func (u DB) SetUser(user *User)

func (DB) Size

func (u DB) Size() int

type User

type User struct {
	Id                   string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Username             string   `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
	Hash                 string   `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,omitempty"`
	Salt                 string   `protobuf:"bytes,4,opt,name=salt,proto3" json:"salt,omitempty"`
	Permissions          []string `protobuf:"bytes,5,rep,name=permissions,proto3" json:"permissions,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func New

func New(id, username, password string, permissions []string) (*User, error)

func (*User) Descriptor

func (*User) Descriptor() ([]byte, []int)

func (*User) GetHash

func (m *User) GetHash() string

func (*User) GetId

func (m *User) GetId() string

func (*User) GetPermissions added in v0.1.1

func (m *User) GetPermissions() []string

func (*User) GetSalt

func (m *User) GetSalt() string

func (*User) GetUsername

func (m *User) GetUsername() string

func (*User) HasPermission added in v0.1.1

func (m *User) HasPermission(permission string) bool

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) Reset

func (m *User) Reset()

func (*User) String

func (m *User) String() string

func (User) Validate

func (m User) Validate(id, password string) bool

func (*User) XXX_DiscardUnknown

func (m *User) XXX_DiscardUnknown()

func (*User) XXX_Marshal

func (m *User) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*User) XXX_Merge

func (m *User) XXX_Merge(src proto.Message)

func (*User) XXX_Size

func (m *User) XXX_Size() int

func (*User) XXX_Unmarshal

func (m *User) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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