domain

package
v0.0.0-...-091106e Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UserTypeAdmin - can upload content, generate tokens and basically do anything
	UserTypeAdmin = iota
	// Customer that can download content with relevant token or with credentials
	UserTypeUser
)

Variables

View Source
var UserFilterFields = []string{"hash"}

UserFilterFields is the list of fields we should filter when sending to clients

Functions

func GetHashFromPassword

func GetHashFromPassword(password string) string

GetHashFromPassword returns the hash based on bcrypt

Types

type Download

type Download struct {
	Name       string    `json:"name"`
	Path       string    `json:"path"`
	SHA256     string    `json:"sha256"`
	GitHash    string    `json:"gitHash" db:"git_hash"`
	Username   string    `json:"username"`
	ModifyDate time.Time `json:"modifyDate" db:"modify_date"`
}

type DownloadLog

type DownloadLog struct {
	Username   string    `json:"username"`
	Name       string    `json:"name"`
	Path       string    `json:"path"`
	IP         string    `json:"ip"`
	ModifyDate time.Time `json:"modifyDate" db:"modify_date"`
}

type Token

type Token struct {
	Name      string `json:"name"`
	Downloads int    `json:"downloads"`
}

func NewToken

func NewToken(downloads int) *Token

NewToken with the given number of downloads

type User

type User struct {
	Username   string    `json:"username"`
	Hash       string    `json:"hash"`
	Email      string    `json:"email"`
	Name       string    `json:"name"`
	Type       UserType  `json:"type"`
	LastLogin  time.Time `json:"lastLogin" db:"last_login"`
	Token      string    `json:"token"`
	ModifyDate time.Time `json:"modifyDate" db:"modify_date"`
}

User holds information about a user within the system. A user has a role for each project.

func (*User) SetPassword

func (u *User) SetPassword(password string)

SetPassword sets the password on the user with bcrypt

func (*User) UsernameForToken

func (u *User) UsernameForToken() string

type UserType

type UserType int

func (UserType) String

func (s UserType) String() string

Stringer implementation

Jump to

Keyboard shortcuts

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