Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFound if the user does not exist in a store. ErrNotFound = wwm.Error{"User does not exist", http.StatusNotFound} )
View Source
var ( // Hans is a pseudo user with admin role Hans = User{ Login: Login{ Mail: "hans@gmail.com", Password: "hansistsogeil", }, Roles: []string{"admin"}, PayPal: PayPal{ MeLink: "http://www.paypal.me/hans", }, } )
View Source
var (
// RoleAdmin the super role for a user
RoleAdmin = "admin"
)
Functions ¶
This section is empty.
Types ¶
type PayPal ¶
type PayPal struct {
MeLink string `json:"meLink"`
}
PayPal contains the information needed for a PayPal payment.
type PublicUser ¶
type PublicUser struct { Mail string `json:"mail"` PayPalMeLink string `json:"payPalMeLink"` Roles []string `json:"roles"` }
PublicUser contains all information of a user that are not private.
type ReadStore ¶
type ReadStore interface { FindByMail(string) (User, error) FindAll() ([]User, error) FindByRegistrationID(registrationID string) (User, error) }
ReadStore can be used to do query operations for a User. The Mail of Login is used as id.
type User ¶
type User struct { Login `json:"login"` PayPal PayPal `json:"payPal"` RegistrationID string `json:"registrationID"` Roles []string `json:"roles"` DefaultOrders map[string]int `json:"defaultOrders"` MailEnabled bool `json:"mailEnabled"` }
User describes the aggregate of a user.
func (User) HasMail ¶
HasMail finds out if the User has at least one of the given mails. If the user is an admin he always wins.
func (User) HasRole ¶
HasRole finds out if the user has at a least one of the given roles. If the user is an admin he always wins.
func (User) IsRegistered ¶
IsRegistered returns if the user is fully registered.
func (User) PublicUser ¶
func (u User) PublicUser() (p PublicUser)
PublicUser representation of a user.
Click to show internal directories.
Click to hide internal directories.