Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessRole ¶ added in v1.5.6
type AccessRole struct { Name string `json:"name" bson:"name"` Root []string `json:"root" bson:"root"` }
func AccessAdmin ¶ added in v1.5.6
func AccessAdmin() *AccessRole
AccessAdmin represents the access to a webapp with admin role.
func AccessEmployee ¶ added in v1.5.6
func AccessEmployee() *AccessRole
AccessEmployee represents the access to a webapp with employee role.
func AccessMember ¶ added in v1.5.6
func AccessMember() *AccessRole
AccessMember represents the access to a webapp with member role.
type Content ¶ added in v1.4.37
type Content struct {
Fields map[string]interface{} `json:"content" bson:"content"`
}
type Count ¶ added in v1.4.32
type Count struct {
Total int32 `json:"total" bson:"total"`
}
Count is used for counting results in db aggregations
type DeletedResponse ¶ added in v1.4.21
type DeletedResponse struct {
ID string `json:"id"`
}
DeletedResponse used for handling response in deleted case.
func NewDeletedResponse ¶ added in v1.4.24
func NewDeletedResponse(id string) *DeletedResponse
NewDeletedResponse creates a new DeletedResponse type.
type IDParam ¶ added in v1.4.21
type IDParam struct {
ID string `param:"id" validate:"uuid"`
}
IDParam data struct for handling '/:id'. ID needs to be a uuid.
type ModelID ¶ added in v1.5.0
func NewModelID ¶ added in v1.5.0
type Modified ¶
type Modified struct { Updated int64 `json:"updated" bson:"updated"` Created int64 `json:"created" bson:"created"` }
Modified contains update and create time for an model.
type Money ¶ added in v1.4.4
type Money struct { Amount int64 `bson:"amount" json:"amount"` Currency string `bson:"currency" json:"currency" validate:"required"` }
Money represent the simple Money object. The Amount is a cent representation.
type Position ¶ added in v1.4.4
Position represents the lat and lng coordinates for latitude and longitude.
type Role ¶ added in v1.4.4
type Role struct { ID string `json:"id" bson:"_id"` Name string `json:"name" bson:"name"` Root string `json:"root" bson:"root"` UserID string `json:"user_id" bson:"user_id"` }
Role represents an struct for handling access roles.
func RoleEmployee ¶ added in v1.4.4
RoleEmployee represents the employee role.
func RoleMember ¶ added in v1.4.4
RoleMember represents the member role.
type RoleList ¶ added in v1.4.4
type RoleList []Role
RoleList represents an slice of Role
func (*RoleList) Append ¶ added in v1.4.4
Append append a Role role to a RoleList i. If i contains the role, nothing happend.
func (*RoleList) Cookie ¶ added in v1.4.4
func (i *RoleList) Cookie() (r *RoleListCookie)
Cookie return an slice of strings they contains all role names.
type RoleListCookie ¶ added in v1.4.4
type RoleListCookie []string
RoleListCookie used for the access_token.
func (*RoleListCookie) CheckRoot ¶ added in v1.4.4
func (i *RoleListCookie) CheckRoot(role *Role) bool
CheckRoot check if the RoleListCookie object contains an role in the Root param. So you can check if an user is allow to give an other user an role.
func (*RoleListCookie) Validate ¶ added in v1.4.4
func (i *RoleListCookie) Validate(roles string) bool
Validate check if an RoleListCookie contains an role in the roles string. We seperate the role by ;.
Example:
"admin;employee"
type User ¶
type User struct { ID string `json:"id,omitempty" bson:"_id"` Email string `json:"email" bson:"email"` FirstName string `bson:"first_name" json:"first_name"` LastName string `bson:"last_name" json:"last_name"` FullName string `bson:"full_name" json:"full_name"` RealName string `bson:"real_name" json:"real_name"` DisplayName string `bson:"display_name" json:"display_name"` Roles RoleList `json:"system_roles" bson:"system_roles"` Country string `bson:"country" json:"country"` PrivacyPolicy bool `bson:"privacy_policy" json:"privacy_policy"` Confirmd bool `bson:"confirmed" json:"confirmed"` LastUpdate string `bson:"last_update" json:"last_update"` }
User represents the user default user information they are shared with all viva con agua services.
func (*User) CheckUpdate ¶ added in v1.4.4
CheckUpdate checks if the lastUpdate time string is older as the users LastUpdate param. If the function return true, the user needs to be updated in this service.
type WebappAccess ¶ added in v1.5.6
type WebappAccess struct { Name string `json:"name" validate:"required"` Roles []AccessRole `json:"roles" validate:"required"` }