Documentation ¶
Index ¶
- type Account
- type AccountRole
- type AccountService
- type Accounts
- type AddAccountRoleReq
- type ConfirmEmailRequest
- type Confirmation
- type ConfirmationService
- type ConfirmationType
- type CreateRoleReq
- type EditRoleReq
- type LoginCredentials
- type ResetPasswordRequest
- type Role
- type RolePermission
- type RoleService
- type Roles
- type Row
- type Session
- type SessionService
- type SessionView
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { Row FirstName string `db:"first_name"` LastName string `db:"last_name"` DOB time.Time Gender *string Active bool FailedLoginsCount int64 `db:"failed_logins_count"` DoorCode *string `db:"door_code"` PassHash string Email string ConfirmedEmail bool `db:"confirmed_email"` PhoneNumber *string `db:"phone_number"` ConfirmedPhone bool `db:"confirmed_phone"` ZipCode string `db:"zip_code"` ReviewTime *time.Time `db:"review_time"` // timestamp of when the account was reviewed ExternalPaymentCustomerID *int64 `db:"external_payment_customer_id"` // fields to populate Roles Roles }
Account represents a user account
type AccountRole ¶
type AccountService ¶
type AddAccountRoleReq ¶
type AddAccountRoleReq struct {
AccountID, RoleID int64
}
type ConfirmEmailRequest ¶
type ConfirmEmailRequest struct {
ConfirmationKey string
}
type Confirmation ¶
type Confirmation struct { Row Type ConfirmationType AccountID int64 `db:"account_id"` Key string ConfirmationTarget *string `db:"confirmation_target"` FailedConfirmationsCount int64 `db:"failed_confirmations_count"` ConfirmTime *time.Time `db:"confirm_time"` ExpireTime *time.Time `db:"expire_time"` }
type ConfirmationService ¶
type ConfirmationService interface { PendingConfirmationByKey(key string) (*Confirmation, error) Confirm(id int64) (*Confirmation, error) FailedConfirmationIncrease(id int64) (*Confirmation, error) }
type ConfirmationType ¶
type ConfirmationType int
const ( ConfirmationTypeEmail ConfirmationType = iota ConfirmationTypePhone ConfirmationTypePasswordReset )
type CreateRoleReq ¶
type CreateRoleReq struct {
Name string
}
type EditRoleReq ¶
type LoginCredentials ¶
type ResetPasswordRequest ¶
type ResetPasswordRequest struct {
Email string
}
type Role ¶
type Role struct { Row Name string PermissionsBit RolePermission `db:"permission_bit"` // Synthetic field Permissions []string }
func (Role) HasPermission ¶
func (r Role) HasPermission(permission RolePermission) bool
HasPermission reports whether a role has the given permission
type RolePermission ¶
type RolePermission int
const ( PermissionAccountsView RolePermission = 1 << iota PermissionAccountsEdit PermissionAccountsDeactivate PermissionAuthorizationsView PermissionAuthorizationsCreate PermissionAuthorizationsEdit PermissionAuthorizationsDelete PermissionRolesView PermissionRolesCreate PermissionRolesEdit PermissionRolesDelete LastPermission )
func StringToRolePermission ¶
func StringToRolePermission(s string) RolePermission
func (RolePermission) Int ¶
func (rp RolePermission) Int() int
func (RolePermission) String ¶
func (r RolePermission) String() string
type RoleService ¶
type Session ¶
type Session struct { Row AccountID int64 `db:"account_id"` Token string `db:"token"` LastActivityTime time.Time `db:"last_activity_time"` ExpirationTime time.Time `db:"expiration_time"` }
Session represents an account session
type SessionService ¶
Click to show internal directories.
Click to hide internal directories.