Documentation
¶
Index ¶
- func RandomConfirmationCode(length int) string
- func RandomPassword(length int) string
- type API
- func (h API) AddAccountRole(w http.ResponseWriter, r *http.Request)
- func (h API) AuthMiddleware(next http.Handler) http.Handler
- func (h API) AuthorizeAccount(accountID int64, permission hmm.RolePermission) error
- func (h API) ConfirmEmail(w http.ResponseWriter, r *http.Request)
- func (h API) CreateRole(w http.ResponseWriter, r *http.Request)
- func (h API) CreateSession(w http.ResponseWriter, r *http.Request)
- func (h API) EditRole(w http.ResponseWriter, r *http.Request)
- func (h API) ExpireSession(w http.ResponseWriter, r *http.Request)
- func (h API) GetAccount(w http.ResponseWriter, r *http.Request)
- func (h API) GetAccountRoles(w http.ResponseWriter, r *http.Request)
- func (h API) GetAccounts(w http.ResponseWriter, r *http.Request)
- func (h API) GetRoles(w http.ResponseWriter, r *http.Request)
- func (h API) GetSession(w http.ResponseWriter, r *http.Request)
- func (h API) ResetPassword(w http.ResponseWriter, r *http.Request)
- type Account
- type AccountRole
- type CreateAccountRequest
- type JSONError
- type Resources
- func (re Resources) CreateAccount(w http.ResponseWriter, r *http.Request)
- func (h Resources) NotImplementedHandler(w http.ResponseWriter, r *http.Request)
- func (a Resources) RespondJSON(w http.ResponseWriter, object interface{})
- func (a Resources) RespondJSONError(w http.ResponseWriter, errorMessage string, code int)
- func (a Resources) RespondText(w http.ResponseWriter, text string, code int)
- func (a Resources) Unmarshal(r *http.Request, iface interface{}) error
- func (h Resources) Version(w http.ResponseWriter, r *http.Request)
- type Role
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandomConfirmationCode ¶
RandomConfirmationCode generates a random confirmation code of a specified length using digits 0-9.
func RandomPassword ¶
RandomPassword generates a random password of a specified length using uppercase and lowercase letters, numbers, and special characters.
Types ¶
type API ¶
func (API) AddAccountRole ¶
func (h API) AddAccountRole(w http.ResponseWriter, r *http.Request)
func (API) AuthorizeAccount ¶
func (h API) AuthorizeAccount(accountID int64, permission hmm.RolePermission) error
func (API) ConfirmEmail ¶
func (h API) ConfirmEmail(w http.ResponseWriter, r *http.Request)
func (API) CreateRole ¶
func (h API) CreateRole(w http.ResponseWriter, r *http.Request)
func (API) CreateSession ¶
func (h API) CreateSession(w http.ResponseWriter, r *http.Request)
func (API) ExpireSession ¶
func (h API) ExpireSession(w http.ResponseWriter, r *http.Request)
func (API) GetAccount ¶
func (h API) GetAccount(w http.ResponseWriter, r *http.Request)
func (API) GetAccountRoles ¶
func (h API) GetAccountRoles(w http.ResponseWriter, r *http.Request)
func (API) GetAccounts ¶
func (h API) GetAccounts(w http.ResponseWriter, r *http.Request)
func (API) GetSession ¶
func (h API) GetSession(w http.ResponseWriter, r *http.Request)
func (API) ResetPassword ¶
func (h API) ResetPassword(w http.ResponseWriter, r *http.Request)
type Account ¶
type Account struct {
ID int64 `json:"ID"`
FirstName, LastName, Email string
DOB string `json:"DateOfBird"`
PhoneNumber string
DoorCode string
Gender string
Active bool
ConfirmedEmail bool
ConfirmedPhone bool
FailedLoginsCount int64
Roles []Role
}
Account is the restricted response body of hmm.Account see: https://stackoverflow.com/questions/46427723/golang-elegant-way-to-omit-a-json-property-from-being-serialized
type AccountRole ¶
func AccountRoleView ¶
func AccountRoleView(ar *hmm.AccountRole, options map[string]bool) AccountRole
type CreateAccountRequest ¶
type CreateAccountRequest struct {
FirstName string
LastName string
DOBString string `json:"dob"`
DOB time.Time `json:"-"`
Gender *string
PhoneNumber *string
Email string
Password string
}
func (*CreateAccountRequest) ValidateAndNormalize ¶
func (r *CreateAccountRequest) ValidateAndNormalize() error
type Resources ¶
type Resources struct {
AccountService hmm.AccountService
SessionService hmm.SessionService
ConfirmationService hmm.ConfirmationService
RoleService hmm.RoleService
Logger logger.Logger
}
func (Resources) CreateAccount ¶
func (re Resources) CreateAccount(w http.ResponseWriter, r *http.Request)
func (Resources) NotImplementedHandler ¶
func (h Resources) NotImplementedHandler(w http.ResponseWriter, r *http.Request)
NotImplementedHandler responds with a 501 status code and a message indicating that the requested functionality has not been implemented.
func (Resources) RespondJSON ¶
func (a Resources) RespondJSON(w http.ResponseWriter, object interface{})
func (Resources) RespondJSONError ¶
func (a Resources) RespondJSONError(w http.ResponseWriter, errorMessage string, code int)
func (Resources) RespondText ¶
func (a Resources) RespondText(w http.ResponseWriter, text string, code int)
Click to show internal directories.
Click to hide internal directories.