user_model

package
v0.0.0-...-0eeeb36 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GENDER_FEMALE int64 = 2
View Source
var GENDER_MALE int64 = 1
View Source
var GENDER_UNKNOWN int64 = 0

Functions

This section is empty.

Types

type User

type User struct {
	Id           int64  `json:"id" db:"id"`
	FullName     string `json:"fullName" db:"fullName"`
	Email        string `json:"email" db:"email"`
	Verified     bool   `json:"isVerified" db:"isVerified"`
	AltEmails    []email_model.Email
	Password     string    `json:"password" db:"password"`
	Gender       int64     `json:"gender" db:"gender"`
	Photo        string    `json:"photo" db:"photo"`
	MinAge       int64     `json:"minAge" db:"minAge"`
	MaxAge       int64     `json:"maxAge" db:"maxAge"`
	Created      time.Time `json:"created" db:"created"`
	Enabled      bool      `json:"enabled" db:"enabled"`
	LastModified time.Time `json:"lastModified" db:"lastModified"`
	Permissions  []*permission_model.Permission
	Groups       []*group_model.Group
}

TODO remove user json binding and create a user input.

func (*User) GetUserAclPermissionsAndGroups

func (user *User) GetUserAclPermissionsAndGroups() *UserAcl

func (*User) GetUserAdminDisplay

func (user *User) GetUserAdminDisplay() *UserAdminDisplay

helper function to get userAdminDisplay from user object

func (*User) GetUserContextHeader

func (user *User) GetUserContextHeader() *UserContextHeader

helper function to get userContextHeader from user object

func (*User) GetUserDisplay

func (user *User) GetUserDisplay() *UserDisplay

helper function to get userDisplay from user object

type UserAcl

type UserAcl struct {
	Permissions []*UserAclPermission `json:"permissions"`
	Groups      []*UserAclGroup      `json:"groups"`
}

type UserAclGroup

type UserAclGroup struct {
	Id   int64  `json:"id"`
	Name string `json:"name"`
}

type UserAclPermission

type UserAclPermission struct {
	Id                   int64  `json:"id"`
	Name                 string `json:"name"`
	InheritedFromGroupId int64  `json:"inheritedFromGroupId,omitempty"`
}

type UserAdminDisplay

type UserAdminDisplay struct {
	Id           int64     `json:"id,omitempty"`
	FullName     string    `json:"fullName,omitempty"`
	Email        string    `json:"email,omitempty"`
	Verified     bool      `json:"verified,omitempty"`
	Gender       int64     `json:"gender,omitempty"`
	Photo        string    `json:"photo,string,omitempty"`
	Enabled      bool      `json:"enabled,omitempty"`
	MinAge       int64     `json:"minAge,omitempty"`
	MaxAge       int64     `json:"maxAge,omitempty"`
	Created      time.Time `json:"created,omitempty"`
	LastModified time.Time `json:"lastModified,omitempty"`
}

* * @apiDefine UserAdminDisplay * @apiSuccess (Response) {number} id * @apiSuccess (Response) {string} fullName * @apiSuccess (Response) {string} email * @apiSuccess (Response) {number} gender 1=male, 2=female * @apiSuccess (Response) {boolean} enabled true is the user is enabled * @apiSuccess (Response) {boolean} verified true is the user has verified their primary email address * @apiSuccess (Response) {number} minAge * @apiSuccess (Response) {number} maxAge * @apiSuccess (Response) {string} created * @apiSuccess (Response) {string} lastModified

type UserChangePasswordInput

type UserChangePasswordInput struct {
	Password    string `json:"password,omitempty"`
	NewPassword string `json:"newPassword,omitempty"`
}

* * @apiDefine UserChangePasswordInput * @apiParam (Request) {string} password The current users password. * @apiParam (Request) {string} newPassword

type UserContextHeader

type UserContextHeader struct {
	Id       int64    `json:"id"`
	FullName string   `json:"fullName"`
	Email    string   `json:"email"`
	ACL      *UserAcl `json:"acl"`
}

func UnmarshalUserContextHeader

func UnmarshalUserContextHeader(data []byte) *UserContextHeader

func (*UserContextHeader) Marshal

func (userContextHeader *UserContextHeader) Marshal() string

type UserDisplay

type UserDisplay struct {
	Id           int64     `json:"id,omitempty"`
	FullName     string    `json:"fullName,omitempty"`
	Email        string    `json:"email,omitempty"`
	Gender       int64     `json:"gender,omitempty"`
	Photo        string    `json:"photo,string,omitempty"`
	LastModified time.Time `json:"lastModified,omitempty"`
}

* * @apiDefine UserDisplay * @apiSuccess (Response) {number} id * @apiSuccess (Response) {string} fullName * @apiSuccess (Response) {string} email * @apiSuccess (Response) {number} gender 1=male, 2=female * @apiSuccess (Response) {string} photo url string * @apiSuccess (Response) {string} lastModified

type UserPasswordInput

type UserPasswordInput struct {
	Password string `json:"password,omitempty"`
}

* * @apiDefine UserPasswordInput * @apiParam (Request) {string} password The current users password.

type UserUpdateInput

type UserUpdateInput struct {
	FullName string `json:"fullName,omitempty"`
	Gender   int64  `json:"gender"`
}

* * @apiDefine UserUpdateInput * @apiParam (Request) {string} fullName * @apiParam (Request) {number} gender 1=male, 2=female

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL