Documentation
¶
Index ¶
Constants ¶
const DeviceTypeCommunal = "communal"
const DeviceTypeCompanion = "companion"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct {
ID string `bson:"_id" json:"id"`
Type string `bson:"type" json:"type"`
Code string `bson:"code" json:"code,omitempty"`
Owner bson.ObjectId `bson:"owner,omitempty" json:"owner,omitempty"`
Aux string `bson:"aux,omitempty" json:"aux,omitempty"`
}
func (*Device) GenerateId ¶
func (d *Device) GenerateId()
func (*Device) RefreshCode ¶
func (d *Device) RefreshCode()
RefreshCode generates a new random 6 digit connection code
type Key ¶
type Key struct {
ID bson.ObjectId `bson:"_id,omitempty" json:"id"`
Title string `bson:"title" json:"title,omitempty"`
Slug string `bson:"slug" json:"slug,omitempty"`
Data []byte `bson:"data,omitempty" json:"data"`
}
func (*Key) GenerateSlug ¶
func (k *Key) GenerateSlug()
type Profile ¶
type Profile struct {
Companion map[string]interface{} `bson:"companion" json:"companion"`
Communal map[string]interface{} `bson:"communal" json:"communal"`
}
The Profile type provides a map for companion and communal devices allowing arbitry storage of key value pairs.
type Token ¶
type Token struct {
ID bson.ObjectId `bson:"_id,omitempty" json:"-"`
ExpiresAt time.Time `bson:"expires" json:"expires_at"`
Token string `bson:"token" json:"access_token"`
User bson.ObjectId `bson:"user" json:"-"`
Client bson.ObjectId `bson:"client,omitempty" json:"-"`
Aux string `bson:"aux,omitempty" json:"aux,omitempty"`
}
type User ¶
type User struct {
ID bson.ObjectId `bson:"_id,omitempty" json:"id"`
DisplayName string `bson:"display_name,omitempty" json:"display_name,omitempty"`
FirstName string `bson:"first_name,omitempty" json:"first_name,omitempty"`
LastName string `bson:"last_name,omitempty" json:"last_name,omitempty"`
Email string `bson:"email,omitempty" json:"email"`
PlainPassword string `bson:"-" json:"password,omitempty"`
Password []byte `bson:"password,omitempty" json:"-"`
Roles []string `bson:"roles,omitempty" json:"roles,omitempty"`
Groups []string `bson:"groups,omitempty" json:"groups,omitempty"`
Settings map[string]interface{} `bson:"settings" json:"settings"`
Profile *Profile `bson:"profile,omitempty" json:"profile,omitempty"`
}
The User type encapsulates details about a user and their profile