domain

package
v0.0.0-...-41931c1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2014 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticationMiddleware

func AuthenticationMiddleware(req *http.Request, context martini.Context, r render.Render)

Check Authorization token

func DomainMiddleware

func DomainMiddleware() martini.Handler

Make all domain structs available as martini middleware

Types

type AuthenticationRequest

type AuthenticationRequest struct {
	Username string `binding:"required"`
	Password string `binding:"required"`
}

type Channel

type Channel struct {
	Uid         string    `json:"uid"`
	Name        string    `json:"name",binding:"required"`
	Description string    `json:"description",binding:"required"`
	Private     bool      `json:"isPrivate",binding:"required"`
	CreatedBy   UserUid   `json:"createdBy"` // the user UID of the admin
	Members     []UserUid `json:"members"`
}

type ChannelDomain

type ChannelDomain struct {
	Collection *mgo.Collection
}

func (ChannelDomain) CreateChannel

func (cd ChannelDomain) CreateChannel(channel *Channel, userUid *UserUid) (*string, error)

Creates a new channel, returns the Channel ID

func (ChannelDomain) GetUserChannels

func (cd ChannelDomain) GetUserChannels(userUid *UserUid) (*[]Channel, error)

Returns all channels this user is in

func (ChannelDomain) ListChannels

func (cd ChannelDomain) ListChannels() (*[]Channel, error)

type NewUser

type NewUser struct {
	Email    string `binding:"required"`
	Username string `binding:"required"`
	Password string `binding:"required"`
}

type User

type User struct {
	Uid          UserUid `json:"uid"`
	Email        string  `json:"email"`
	Username     string  `json:"username"`
	PasswordHash string  `json:"passwordHash,omitempty"`
	GravatarHash string  `json:"gravatarHash"`
}

type UserDomain

type UserDomain struct {
	Collection *mgo.Collection
}

func (UserDomain) Authenticate

func (ud UserDomain) Authenticate(ar *AuthenticationRequest) (*string, error)

Attempts to authenticate a user and returns a JWT if successful

func (UserDomain) CreateUser

func (ud UserDomain) CreateUser(newUser *NewUser) (*UserUid, error)

Creates a User from a NewUser struct. Returns the new user's UID

func (UserDomain) UserByUid

func (ud UserDomain) UserByUid(uid UserUid) (*User, error)

type UserUid

type UserUid string

Jump to

Keyboard shortcuts

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