Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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" validate:"required"` 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"` Label string `json:"label" bson:"label"` 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"` 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.