user

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: MIT Imports: 7 Imported by: 3

Documentation

Overview

Package use provides user and group usage api.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	Name    string
	Leader  string
	Members map[string]Role
	Root    *storage.Root
}

func GenerateGroup

func GenerateGroup(name, leader string) *Group

func GroupFromBytes

func GroupFromBytes(data []byte) (*Group, error)

func NewGroup

func NewGroup(name, leader string, members map[string]Role, root *storage.Root) *Group

func (*Group) RemoveMember

func (g *Group) RemoveMember(user, member string) bool

func (*Group) ToBytes

func (g *Group) ToBytes() []byte

func (*Group) UpdateLeader

func (g *Group) UpdateLeader(user, newLeader string) bool

func (*Group) UpdateMemberRole

func (g *Group) UpdateMemberRole(user, member string, role Role) bool

type Operation

type Operation struct {
	Address   string
	PublicKey string
	Sea       string
	Path      string
	Name      string
	Size      int64
	Hash      string
	Timestamp int64
	Signature string
}

func NewOperation

func NewOperation(address, publicKey, sea, path, name, hash string, size, timestamp int64, signer signing.Signer) *Operation

func OperationFromBytes

func OperationFromBytes(data []byte) (*Operation, error)

func (*Operation) ToBytes

func (o *Operation) ToBytes() []byte

func (*Operation) Verify

func (o *Operation) Verify() bool

type Role

type Role uint8
var (
	RoleGuest      Role = 1
	RoleDeveloper  Role = 2
	RoleMaintainer Role = 3
	RoleOwner      Role = 4
)

type User

type User struct {
	PublicKey string
	Groups    []string
	Root      *storage.Root
}

func GenerateUser

func GenerateUser(publicKey string) *User

func NewUser

func NewUser(publicKey string, groups []string, root *storage.Root) *User

func UserFromBytes

func UserFromBytes(data []byte) (*User, error)

func (*User) IsInGroup

func (u *User) IsInGroup(group string) bool

func (*User) JoinGroup

func (u *User) JoinGroup(group string) bool

func (*User) LeaveGroup

func (u *User) LeaveGroup(group string) bool

func (*User) ToBytes

func (u *User) ToBytes() []byte

func (*User) VerifyPublicKey

func (u *User) VerifyPublicKey(publicKey string) bool

Jump to

Keyboard shortcuts

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