servicer

package
v0.0.0-...-9581e64 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2017 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const AllUserPerms = uint64(0x7)

0111b -- TODO(dan) AllPerms(permset) (uint64, error) in basic

Variables

View Source
var (
	UserNotFound         = errors.New("user not found")
	CustomerNotFound     = errors.New("customer not found")
	TeamNotFound         = errors.New("team not found")
	SignupNotFound       = errors.New("customer not found")
	SignupExists         = errors.New("signup exists with that email")
	SignupAlreadyClaimed = errors.New("signup already claimed")
	SignupInvalidToken   = errors.New("invalid token for signup")
)

Functions

func AuthenticateUser

func AuthenticateUser(user *schema.User, password string) error

func ClaimSignup

func ClaimSignup(id int, token, name, password string, verified bool) (*schema.User, error)

func CreateActiveInvite

func CreateActiveInvite(teamName, senderEmail, customerId, email string, perms *schema.UserFlags) (*schema.Invite, error)

func CreateActiveUser

func CreateActiveUser(email, name, password, referrer string) (*schema.User, error)

func DeleteSignup

func DeleteSignup(id int) error

func DeleteTeam

func DeleteTeam(id string) error

Sets customer to inactive

func DeleteUser

func DeleteUser(id int) error

func EmailTokenUser

func EmailTokenUser(user *schema.User, duration time.Duration, referer string) error

func GetTeam

func GetTeam(id string) (*schema.Team, error)

Gets subset of fields of a customer accessible to team admin

func GetTeamUsers

func GetTeamUsers(id string) ([]*schema.User, error)

Gets subset of fields of a customer accessible to team admin

func GetUser

func GetUser(id int) (*schema.User, error)

func GetUserCustID

func GetUserCustID(id string) (*schema.User, error)

func GetUserData

func GetUserData(id int) ([]byte, error)

func GetUserEmail

func GetUserEmail(email string) (*schema.User, error)

func HMACIntercomUser

func HMACIntercomUser(user *schema.User) (string, error)

func Init

func Init(config Config) error

func InviteTokenUser

func InviteTokenUser(user *schema.User, duration time.Duration) error

func MergeTeam

func MergeTeam(team *schema.Team, name, subscription string) error

func MergeUser

func MergeUser(user *schema.User, email, name, password string) error

func NewUser

func NewUser(name, email, password string) (*schema.User, error)

func SendTemplatedEmail

func SendTemplatedEmail(userId int, template string, vars map[string]interface{}) (*schema.User, error)

func SendVerification

func SendVerification(user *schema.User)

func TokenUser

func TokenUser(user *schema.User, duration time.Duration) (string, error)

func UpdateTeam

func UpdateTeam(team *schema.Team, name string, subscription string) (*schema.Team, error)

Updates subset of fields of a customer accessible to team admin (name, subscription)

func UpdateUser

func UpdateUser(user *schema.User, email, name, password string, duration time.Duration) (string, error)

func UpdateUserData

func UpdateUserData(id int, data []byte) ([]byte, error)

func UpdateUserPerms

func UpdateUserPerms(user *schema.User, perms *schema.UserFlags, duration time.Duration) (string, error)

func VerificationToken

func VerificationToken(id string) string

func VerifyToken

func VerifyToken(id, token string) bool

func VerifyUser

func VerifyUser(user *schema.User, token string) (bool, error)

Types

type Config

type Config struct {
	Host        string
	MandrillKey string
	IntercomKey string
	CloseIOKey  string
	SlackUrl    string
}

type MandrillMailer

type MandrillMailer interface {
	MessagesSendTemplate(*mandrill.Message, string, interface{}) ([]*mandrill.Response, error)
}

type PaginatedUsers

type PaginatedUsers struct {
	Page    int
	PerPage int
	Total   int
	Users   []*schema.User
}

func ListUsers

func ListUsers(perPage int, page int) (*PaginatedUsers, error)

type Signup

type Signup struct {
	Id         int               `json:"id"`
	Email      string            `json:"email"`
	Name       string            `json:"name"`
	Claimed    bool              `json:"claimed"`
	Activated  bool              `json:"activated"`
	Referrer   string            `json:"referrer"`
	CreatedAt  time.Time         `json:"created_at" db:"created_at"`
	UpdatedAt  time.Time         `json:"updated_at" db:"updated_at"`
	CustomerId string            `json:"-" db:"customer_id"`
	Perms      *schema.UserFlags `json:"-" db:"perms"`
}

func ActivateSignup

func ActivateSignup(id int) (*Signup, error)

func CreateActiveSignup

func CreateActiveSignup(email, name, referrer string) (*Signup, error)

func GetSignup

func GetSignup(id int) (*Signup, error)

func GetSignupsByCustomerId

func GetSignupsByCustomerId(id string) ([]*Signup, error)

func ListSignups

func ListSignups(perPage int, page int) ([]*Signup, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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