Documentation ¶
Index ¶
- Variables
- func RespCreateBase(model string) (int, interface{})
- func RespCreated(i interface{}, model string) (int, interface{})
- func RespDeleted(model string) (int, interface{})
- func RespExecuted(model string) (int, interface{})
- func RespSelected(i interface{}, model string) (int, interface{})
- func RespUpdated(model string) (int, interface{})
- type APIResponse
- type Access
- type AccessList
- type AccessToken
- type Campaign
- type CodeRequest
- type ContentText
- type DisplayContent
- type JWTToken
- type MID
- type MailBase
- type MailCode
- type MailContactAt
- type MultiLang
- type PValidate
- type Permission
- type RefreshToken
- type SimpleID
Constants ¶
This section is empty.
Variables ¶
var AccessConfig = middleware.JWTConfig{ Claims: &AccessToken{}, ContextKey: "token", SigningKey: []byte(os.Getenv("JWT_SECRET")), }
AccessConfig can with echo for middleware.JWTWithConfig(vmod.AccessConfig) to handling access controll The token is reachable with c.Get("token")
var RefreshConfig = middleware.JWTConfig{ Claims: &RefreshToken{}, ContextKey: "token", SigningKey: []byte(os.Getenv("JWT_SECRET")), }
RefreshConfig can with echo for middleware.JWTWithConfig(vmod.AccessConfig) to handling access controll The token is reachable with c.Get("token")
Functions ¶
func RespCreateBase ¶
RespCreateBase creates the created response without payload
func RespCreated ¶
RespCreated creates the created response
func RespDeleted ¶
RespDeleted creates the updated response
func RespExecuted ¶
RespExecuted creates the execution response for handling for example sending emails.
func RespSelected ¶
RespSelected creates the selected response
func RespUpdated ¶
RespUpdated creates the updated response
Types ¶
type APIResponse ¶
type APIResponse struct { Message string `json:"message"` Model string `json:"model"` Payload interface{} `json:"payload,omitempty"` }
APIResponse type that will response in success cases
type Access ¶
type Access struct { Role string `json:"role" bson:"role"` Created int64 `json:"created" bson:"created"` }
Access represents access to an model.
type AccessList ¶
type AccessList []Access
AccessList list of access model
func (AccessList) Map ¶
func (a AccessList) Map() map[string]string
Map converts an access list into map
type AccessToken ¶
type AccessToken struct { User User `json:"user"` jwt.StandardClaims }
AccessToken represents the access token contained in JWTToken
type Campaign ¶
type Campaign struct { ID string `bson:"_id" json:"id" validate:"required"` CiviID int `bson:"civi_id" json:"civi_id" validate:"required"` Name string `bson:"name" json:"name" validate:"required"` Description string `bson:"name" json:"description" validate:"required"` Tags []string `bson:"tags" json:"tags" validate:"required"` Type string `bson:"type" json:"type" validate:"required"` Modified vmdb.Modified `bson:"modified" json:"modified" validate:"required"` }
Campaign represents a default campaign model
type CodeRequest ¶
CodeRequest used for handling LinkToken code.
type ContentText ¶
type DisplayContent ¶
type DisplayContent struct { Language []string `bson:"language" json:"language"` Keys []string `bson:"keys" json:"keys"` Translation map[string]ContentText `bson:"translation" json:"translation"` Default string `bson:"default" json:"default"` }
func (*DisplayContent) Validate ¶
func (dc *DisplayContent) Validate() *DisplayContent
type JWTToken ¶
type JWTToken struct { AccessToken string `json:"access_token" bson:"access_token"` RefreshToken string `json:"refresh_token" bson:"refresh_token"` TokenType string `json:"token_type" bson:"token_type"` ExpiresAt int64 `json:"expires_at" bson:"expires_at"` Scope string `json:"scope" bson:"scope"` }
JWTToken represents the all access and refresh tokens
func NewJWTToken ¶
NewJWTToken returns a new JWTToken model contains an access and an refresh token
type MailBase ¶
type MailBase struct { To string `json:"to" bson:"to"` JobCase string `json:"job_case"` JobScope string `json:"job_scope"` Country string `json:"country"` }
MailBase base model for request mail-backend via nats
type MailContactAt ¶
type MultiLang ¶
type PValidate ¶
PValidate used for controller permission handling
func (*PValidate) Restricted ¶
func (pVal *PValidate) Restricted(next echo.HandlerFunc) echo.HandlerFunc
Restricted middleware function for handling Access
type Permission ¶
type Permission map[string]AccessList
Permission represents role to an access
func NewPermission ¶
func NewPermission(app string, role string) *Permission
NewPermission map role to []Access(modelID, created) and initial Permission.
func (*Permission) Add ¶
func (p *Permission) Add(app string, role string) *Permission
Add Access(modelID created) to role.
func (*Permission) Delete ¶
func (p *Permission) Delete(role string, modelID string) *Permission
Delete Access from role. If []Access is nil the role will remove form Permission.
func (*Permission) Validate ¶
func (p *Permission) Validate(pValidate *PValidate) bool
Validate validates the permission for middleware functions
type RefreshToken ¶
type RefreshToken struct { UserID string `json:"user_id"` jwt.StandardClaims }
RefreshToken represents the refresh token contained in JWTToken