model

package
v0.2.56 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2020 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ACCESS_TOKEN_GRANT_TYPE  = "authorization_code"
	ACCESS_TOKEN_TYPE        = "bearer"
	REFRESH_TOKEN_GRANT_TYPE = "refresh_token"
)
View Source
const (
	HEADER_REQUEST_ID         = "X-Request-ID"
	HEADER_VERSION_ID         = "X-Version-ID"
	HEADER_ETAG_SERVER        = "ETag"
	HEADER_ETAG_CLIENT        = "If-None-Match"
	HEADER_FORWARDED          = "X-Forwarded-For"
	HEADER_REAL_IP            = "X-Real-IP"
	HEADER_FORWARDED_PROTO    = "X-Forwarded-Proto"
	HEADER_TOKEN              = "Token"
	HEADER_BEARER             = "BEARER"
	HEADER_AUTH               = "Authorization"
	HEADER_REQUESTED_WITH     = "X-Requested-With"
	HEADER_REQUESTED_WITH_XML = "XMLHttpRequest"
	STATUS                    = "status"
	STATUS_OK                 = "OK"
	LAST_PICTURE_UPDATE       = "Last_picture_update"

	CLIENT_DIR = "webapp/dist"

	API_URL_SUFFIX = "/sso"
)
View Source
const (
	DATABASE_DRIVER_MYSQL = "mysql"

	CONN_SECURITY_NONE     = ""
	CONN_SECURITY_PLAIN    = "PLAIN"
	CONN_SECURITY_TLS      = "TLS"
	CONN_SECURITY_STARTTLS = "STARTTLS"

	PASSWORD_MAXIMUM_LENGTH = 64
	PASSWORD_MINIMUM_LENGTH = 5

	SERVICE_WEIXIN = "weixin"

	WEBSERVER_MODE_REGULAR  = "regular"
	WEBSERVER_MODE_GZIP     = "gzip"
	WEBSERVER_MODE_DISABLED = "disabled"

	FAKE_SETTING = "********************************"

	SITENAME_MAX_LENGTH = 30

	SERVICE_SETTINGS_DEFAULT_SITE_URL        = ""
	SERVICE_SETTINGS_DEFAULT_TLS_CERT_FILE   = ""
	SERVICE_SETTINGS_DEFAULT_TLS_KEY_FILE    = ""
	SERVICE_SETTINGS_DEFAULT_READ_TIMEOUT    = 300
	SERVICE_SETTINGS_DEFAULT_WRITE_TIMEOUT   = 300
	SERVICE_SETTINGS_DEFAULT_ALLOW_CORS_FROM = ""
)
View Source
const (
	SESSION_COOKIE_TOKEN  = "AUTHTOKEN"
	SESSION_COOKIE_USER   = "USERID"
	SESSION_CACHE_SIZE    = 35000
	SESSION_PROP_PLATFORM = "platform"
	SESSION_PROP_OS       = "os"
	SESSION_PROP_BROWSER  = "browser"
)
View Source
const (
	OAUTH_ACTION_SIGNUP = "signup"
	OAUTH_ACTION_LOGIN  = "login"
)
View Source
const (
	TOKEN_SIZE                  = 64
	MAX_TOKEN_EXIPRY_TIME       = 1000 * 60 * 60 * 24 // 24 hour
	MAX_SMS_TOKEN_EXIPRY_TIME   = 1000 * 60 * 1       // 1 min
	MAX_EMAIL_TOKEN_EXIPRY_TIME = 1000 * 60 * 1       // 1 min
	SEND_CODE_MAX               = 60
	TOKEN_TYPE_OAUTH            = "oauth"
)
View Source
const (
	ME = "me"

	DEFAULT_LOCALE = "zh-CN"

	USER_EMAIL_MAX_LENGTH     = 128
	USER_NICKNAME_MAX_RUNES   = 64
	USER_FIRST_NAME_MAX_RUNES = 64
	USER_LAST_NAME_MAX_RUNES  = 64
	USER_NAME_MAX_LENGTH      = 64
	USER_NAME_MIN_LENGTH      = 3
	USER_PASSWORD_MAX_LENGTH  = 72
)
View Source
const (
	LOWERCASE_LETTERS = "abcdefghijklmnopqrstuvwxyz"
	UPPERCASE_LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	NUMBERS           = "0123456789"
	SYMBOLS           = " !\"\\#$%&'()*+,-./:;<=>?@[]^_`|~"

	USER_AUTH_SERVICE_LDAP = "ldap"
	LDAP_SYNC_TASK_NAME    = "LDAP Syncronization"
)
View Source
const (
	SYSTEM_RAN_UNIT_TESTS = "RanUnitTests"
)
View Source
const (
	StatusBadRequest = http.StatusBadRequest
)
View Source
const (
	USER_AUTH_SERVICE_WECHAT = "weixin"
)

Variables

View Source
var BuildDate string
View Source
var BuildHash string
View Source
var BuildNumber string
View Source
var BuiltInRoles map[string]*Role
View Source
var CurrentVersion string = versions[0]

Functions

func ArrayFromJson

func ArrayFromJson(data io.Reader) []string

func ArrayToJson

func ArrayToJson(objmap []string) string

func ComparePassword

func ComparePassword(hash string, password string) bool

func Etag

func Etag(parts ...interface{}) string

func GetAllTasks

func GetAllTasks() *map[string]*ScheduledTask

func GetMillis

func GetMillis() int64

func GetPreviousVersion

func GetPreviousVersion(version string) string

func HashPassword

func HashPassword(password string) string

func InitalizePermissions

func InitalizePermissions()

func InitalizeRoles

func InitalizeRoles()

func IsCurrentVersion

func IsCurrentVersion(versionToCheck string) bool

func IsOfficalBuild

func IsOfficalBuild() bool

func IsPreviousVersionsSupported

func IsPreviousVersionsSupported(versionToCheck string) bool

func IsValidHttpUrl

func IsValidHttpUrl(rawUrl string) bool

func IsValidUserRoles

func IsValidUserRoles(userRoles string) bool

func IsValidUsername

func IsValidUsername(s string) bool

func MapFromJson

func MapFromJson(data io.Reader) map[string]string

func MapToJson

func MapToJson(objmap map[string]string) string

MapToJson converts a map to a json string

func NewId

func NewId() string

func NewRandomString

func NewRandomString(length int) string

func OAuthAppListToJson

func OAuthAppListToJson(l []*OAuthApp) string

func OAuthAppMapFromJson

func OAuthAppMapFromJson(data io.Reader) map[string]*OAuthApp

func OAuthAppMapToJson

func OAuthAppMapToJson(a map[string]*OAuthApp) string

func RoleIdsToString

func RoleIdsToString(roles []string) string

func SplitVersion

func SplitVersion(version string) (int64, int64, int64)

func StringInterfaceToJson

func StringInterfaceToJson(objmap map[string]interface{}) string

func UserListToJson

func UserListToJson(u []*User) string

Types

type ALiYunCommunicationRequest

type ALiYunCommunicationRequest struct {
	//system parameters
	AccessKeyId      string
	Timestamp        string
	Format           string
	SignatureMethod  string
	SignatureVersion string
	SignatureNonce   string
	Signature        string

	//business parameters
	Action          string
	Version         string
	RegionId        string
	PhoneNumbers    string
	SignName        string
	TemplateCode    string
	TemplateParam   string
	SmsUpExtendCode string
	OutId           string
}

func (*ALiYunCommunicationRequest) BuildSmsRequestEndpoint

func (req *ALiYunCommunicationRequest) BuildSmsRequestEndpoint(accessKeySecret, gatewayUrl string) (string, error)

func (*ALiYunCommunicationRequest) SetParamsValue

func (req *ALiYunCommunicationRequest) SetParamsValue(accessKeyId, phoneNumbers, signName, templateCode, templateParam string) error

func (*ALiYunCommunicationRequest) SmsParamsIsValid

func (req *ALiYunCommunicationRequest) SmsParamsIsValid() error

type AccessData

type AccessData struct {
	ClientId     string `bson:"clientId" json:"client_id"`
	UserId       string `bson:"userId" json:"user_id"`
	Token        string `bson:"token" json:"token"`
	RefreshToken string `bson:"refreshToken" json:"refresh_token"`
	RedirectUri  string `bson:"redirectUri" json:"redirect_uri"`
	ExpiresAt    int64  `bson:"expiresAt" json:"expires_at"`
	Scope        string `bson:"scope" json:"scope"`
}

func AccessDataFromJson

func AccessDataFromJson(data io.Reader) *AccessData

func (*AccessData) IsExpired

func (me *AccessData) IsExpired() bool

func (*AccessData) IsValid

func (ad *AccessData) IsValid() *AppError

func (*AccessData) ToJson

func (ad *AccessData) ToJson() string

type AccessResponse

type AccessResponse struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int32  `json:"expires_in"`
	Scope        string `json:"scope"`
	RefreshToken string `json:"refresh_token"`
	OpenId       string `json:"openid"`
}

func AccessResponseFromJson

func AccessResponseFromJson(data io.Reader) *AccessResponse

func (*AccessResponse) ToJson

func (ar *AccessResponse) ToJson() string

type AppError

type AppError struct {
	Id            string `json:"id"`
	Message       string `json:"message"`               // Message to be display to the end user without debugging information
	DetailedError string `json:"detailed_error"`        // Internal error string to help the developer
	RequestId     string `json:"request_id,omitempty"`  // The RequestId that's also set in the header
	StatusCode    int    `json:"status_code,omitempty"` // The http status code
	Where         string `json:"-"`                     // The function where it happened in the form of Struct.Func
	// contains filtered or unexported fields
}

func AppErrorFromJson

func AppErrorFromJson(data io.Reader) *AppError

AppErrorFromJson will decode the input and return an AppError

func InvalidUserError

func InvalidUserError(fieldName string, userId string) *AppError

func NewAppError

func NewAppError(where string, id string, params map[string]interface{}, details string, status int) *AppError

func NewLocAppError

func NewLocAppError(where string, id string, params map[string]interface{}, details string) *AppError

func (*AppError) Error

func (er *AppError) Error() string

func (*AppError) SystemMessage

func (er *AppError) SystemMessage(T goi18n.TranslateFunc) string

func (*AppError) ToJson

func (er *AppError) ToJson() string

func (*AppError) Translate

func (er *AppError) Translate(T goi18n.TranslateFunc)

type Client

type Client struct {
	Url        string       // The location of the server, for example  "http://localhost:8065"
	ApiUrl     string       // The api location of the server, for example "http://localhost:8065/api/v4"
	HttpClient *http.Client // The http client
	AuthToken  string
	AuthType   string
}

func NewAPIClient

func NewAPIClient(url string) *Client

func (*Client) ClearOAuthToken

func (c *Client) ClearOAuthToken()

func (*Client) CreateUser

func (c *Client) CreateUser(user *User) (*User, *Response)

CreateUser creates a user in the system based on the provided user struct.

func (*Client) DoApiDelete

func (c *Client) DoApiDelete(url string) (*http.Response, *AppError)

func (*Client) DoApiGet

func (c *Client) DoApiGet(url string, etag string) (*http.Response, *AppError)

func (*Client) DoApiPost

func (c *Client) DoApiPost(url string, data string) (*http.Response, *AppError)

func (*Client) DoApiPut

func (c *Client) DoApiPut(url string, data string) (*http.Response, *AppError)

func (*Client) DoApiRequest

func (c *Client) DoApiRequest(method, url, data, etag string) (*http.Response, *AppError)

func (*Client) GetUserRoute

func (c *Client) GetUserRoute(userId string) string

func (*Client) GetUsersRoute

func (c *Client) GetUsersRoute() string

func (*Client) Login

func (c *Client) Login(loginId string, password string) (*User, *Response)

func (*Client) SetOAuthToken

func (c *Client) SetOAuthToken(token string)

type Config

type Config struct {
	SqlSettings            SqlSettings
	ServiceSettings        ServiceSettings
	SupportSettings        SupportSettings
	LogSettings            LogSettings
	EmailSettings          EmailSettings
	EnableSignInWithMobile *bool
	SmsCodeSettings        SmsSettings
	FileSettings           FileSettings
	RateLimitSettings      RateLimitSettings
	PrivacySettings        PrivacySettings
	PasswordSettings       PasswordSettings
	WeixinSettings         SSOSettings
	JWTSettings            JWTSettings
	LocalizationSettings   LocalizationSettings
}

func (*Config) GetJWTService

func (o *Config) GetJWTService() *JWTSettings

func (*Config) GetSSOService

func (o *Config) GetSSOService(service string) *SSOSettings

func (*Config) GetSanitizeOptions

func (o *Config) GetSanitizeOptions() map[string]bool

func (*Config) GetSmsService

func (o *Config) GetSmsService() *SmsSettings

func (*Config) IsValid

func (o *Config) IsValid() *AppError

func (*Config) Sanitize

func (o *Config) Sanitize()

func (*Config) SetDefaults

func (o *Config) SetDefaults()

type CustomClaims

type CustomClaims struct {
	UserId string            `json:"user_id"`
	Roles  string            `json:"roles"`
	Props  map[string]string `json:"props"`
	jwt.StandardClaims
}

func (*CustomClaims) AddProp

func (me *CustomClaims) AddProp(key string, value string)

func (*CustomClaims) GetUserRoles

func (me *CustomClaims) GetUserRoles() []string

func (*CustomClaims) IsExpired

func (me *CustomClaims) IsExpired() bool

func (*CustomClaims) SetExpireInDays

func (me *CustomClaims) SetExpireInDays(days int)

type EmailSettings

type EmailSettings struct {
	EnableSignUpWithEmail             bool
	EnableSignInWithEmail             *bool
	EnableSignInWithUsername          *bool
	FeedbackName                      string
	FeedbackEmail                     string
	FeedbackOrganization              *string
	EnableSMTPAuth                    *bool
	SMTPUsername                      string
	SMTPPassword                      string
	SMTPServer                        string
	SMTPPort                          string
	ConnectionSecurity                string
	SkipServerCertificateVerification *bool
}

type EncryptStringMap

type EncryptStringMap map[string]string

type FileSettings

type FileSettings struct {
	EnableFileAttachments *bool
	MaxFileSize           *int64
	InitialFont           *string
	Directory             *string
}

type JWTSettings

type JWTSettings struct {
	Secret                 string
	Issuer                 string
	ExpireTimeLengthInDays *int
}

type LocalizationSettings

type LocalizationSettings struct {
	DefaultServerLocale *string
	DefaultClientLocale *string
	AvailableLocales    *string
}

type LogSettings

type LogSettings struct {
	EnableConsole bool
	ConsoleLevel  string
	EnableFile    bool
	FileLevel     string
	FileFormat    string
	FileLocation  string
}

type LoginIdAndPassword

type LoginIdAndPassword struct {
	LoginId  string `json:"login_id"`
	Password string `json:"password"`
}

func (*LoginIdAndPassword) ToJson

func (o *LoginIdAndPassword) ToJson() string

type OAuthApp

type OAuthApp struct {
	Id           string      `bson:"_id" json:"id"`
	CreatorId    string      `bson:"creatorId" json:"creator_id"`
	CreateAt     int64       `bson:"createAt" json:"create_at"`
	UpdateAt     int64       `bson:"updateAt" json:"update_at"`
	ClientSecret string      `bson:"clientSecret" json:"client_secret"`
	Name         string      `bson:"name" json:"name"`
	Description  string      `bson:"description" json:"description"`
	IconURL      string      `bson:"iconURL" json:"icon_url"`
	CallbackUrls StringArray `bson:"callbackUrls" json:"callback_urls"`
	Homepage     string      `bson:"homepage" json:"homepage"`
	IsTrusted    bool        `bson:"isTrusted" json:"is_trusted"`
}

func OAuthAppFromJson

func OAuthAppFromJson(data io.Reader) *OAuthApp

OAuthAppFromJson will decode the input and return a User

func OAuthAppListFromJson

func OAuthAppListFromJson(data io.Reader) []*OAuthApp

func (*OAuthApp) Etag

func (a *OAuthApp) Etag() string

Generate a valid strong etag so the browser can cache the results

func (*OAuthApp) IsValid

func (a *OAuthApp) IsValid() *AppError

IsValid validates the app and returns an error if it isn't configured correctly.

func (*OAuthApp) IsValidRedirectURL

func (a *OAuthApp) IsValidRedirectURL(url string) bool

func (*OAuthApp) PreSave

func (a *OAuthApp) PreSave()

PreSave will set the Id and ClientSecret if missing. It will also fill in the CreateAt, UpdateAt times. It should be run before saving the app to the db.

func (*OAuthApp) PreUpdate

func (a *OAuthApp) PreUpdate()

PreUpdate should be run before updating the app in the db.

func (*OAuthApp) Sanitize

func (a *OAuthApp) Sanitize()

Remove any private data from the app object

func (*OAuthApp) ToJson

func (a *OAuthApp) ToJson() string

ToJson convert a User to a json string

type PasswordSettings

type PasswordSettings struct {
	MinimumLength *int
	Lowercase     *bool
	Number        *bool
	Uppercase     *bool
	Symbol        *bool
}

type Permission

type Permission struct {
	Id          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}
var PERMISSION_ASSIGN_SYSTEM_ADMIN_ROLE *Permission
var PERMISSION_EDIT_OTHER_USERS *Permission
var PERMISSION_MANAGE_ROLES *Permission
var PERMISSION_MANAGE_SYSTEM *Permission

type PrivacySettings

type PrivacySettings struct {
	ShowEmailAddress bool
	ShowFullName     bool
}

type RateLimitSettings

type RateLimitSettings struct {
	Enable           *bool
	PerSec           int
	MaxBurst         *int
	MemoryStoreSize  int
	VaryByRemoteAddr bool
	VaryByHeader     string
}

type Response

type Response struct {
	StatusCode    int
	Error         *AppError
	RequestId     string
	Etag          string
	ServerVersion string
}

func BuildErrorResponse

func BuildErrorResponse(r *http.Response, err *AppError) *Response

func BuildResponse

func BuildResponse(r *http.Response) *Response

type Role

type Role struct {
	Id          string   `json:"id"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Permissions []string `json:"permissions"`
}
var ROLE_SYSTEM_ADMIN *Role
var ROLE_USER *Role

type SSOSettings

type SSOSettings struct {
	Enable          bool
	Secret          string
	Id              string
	Scope           string
	AuthEndpoint    string
	TokenEndpoint   string
	UserApiEndpoint string
}

type ScheduledTask

type ScheduledTask struct {
	Name      string        `json:"name"`
	Interval  time.Duration `json:"interval"`
	Recurring bool          `json:"recurring"`
	// contains filtered or unexported fields
}

func CreateRecurringTask

func CreateRecurringTask(name string, function TaskFunc, interval time.Duration) *ScheduledTask

func CreateTask

func CreateTask(name string, function TaskFunc, timeToExecution time.Duration) *ScheduledTask

func GetTaskByName

func GetTaskByName(name string) *ScheduledTask

func (*ScheduledTask) Cancel

func (task *ScheduledTask) Cancel()

func (*ScheduledTask) Execute

func (task *ScheduledTask) Execute()

Executes the task immediatly. A recurring task will be run regularally after interval.

func (*ScheduledTask) String

func (task *ScheduledTask) String() string

type ServiceSettings

type ServiceSettings struct {
	SiteURL                             *string
	SiteName                            string
	ListenAddress                       string
	ConnectionSecurity                  *string
	TLSCertFile                         *string
	TLSKeyFile                          *string
	Forward80To443                      *bool
	ReadTimeout                         *int
	WriteTimeout                        *int
	MaximumLoginAttempts                int
	EnableDeveloper                     *bool
	AllowCorsFrom                       *string
	SessionLengthWebInDays              *int
	SessionCacheInMinutes               *int
	WebserverMode                       *string
	EnableInsecureOutgoingConnections   *bool
	AllowedUntrustedInternalConnections *string
}

type SmsSettings

type SmsSettings struct {
	Enable          bool
	Provider        string
	GatewayUrl      string
	AccessKeyId     string
	AccessKeySecret string
	SignName        string
	TemplateCode    string
}

type SqlSettings

type SqlSettings struct {
	DriverName               string
	DataSource               string
	DataSourceReplicas       []string
	DataSourceSearchReplicas []string
	MaxIdleConns             int
	MaxOpenConns             int
	Trace                    bool
	AtRestEncryptKey         string
	QueryTimeout             *int
}

type Status

type Status struct {
	Status string `json:"status"`
}

func StatusFromJson

func StatusFromJson(data io.Reader) *Status

type StringArray

type StringArray []string

type StringInterface

type StringInterface map[string]interface{}

type StringMap

type StringMap map[string]string

type SupportSettings

type SupportSettings struct {
	TermsOfServiceLink       *string
	PrivacyPolicyLink        *string
	AboutLink                *string
	HelpLink                 *string
	ReportAProblemLink       *string
	AdministratorsGuideLink  *string
	TroubleshootingForumLink *string
	CommercialSupportLink    *string
	SupportEmail             *string
}

type System

type System struct {
	Name  string `bson:"_id" json:"name"`
	Value string `bson:"value" json:"value"`
}

type TaskFunc

type TaskFunc func()

type Token

type Token struct {
	Token    string `bson:"_id"`
	CreateAt int64  `bson:"createAt"`
	Type     string
	Props    StringInterface `bson:"props" json:"props"`
	Extra    string
}

func NewToken

func NewToken(tokentype, extra string, props StringInterface) *Token

func (*Token) IsValid

func (t *Token) IsValid() *AppError

type User

type User struct {
	Id                 string    `bson:"_id" json:"id"`
	CreateAt           int64     `bson:"createAt" json:"create_at,omitempty"`
	UpdateAt           int64     `bson:"updateAt" json:"update_at,omitempty"`
	DeleteAt           int64     `bson:"deleteAt" json:"delete_at"`
	Username           string    `bson:"username" json:"username"`
	Gender             string    `bson:"gender"   json:"gender"`
	Password           string    `bson:"password" json:"password,omitempty"`
	AuthData           *string   `bson:"authData" json:"auth_data,omitempty"`
	AuthService        string    `bson:"authService" json:"auth_service"`
	Email              string    `bson:"email" json:"email"`
	EmailVerified      bool      `bson:"emailVerified" json:"email_verified,omitempty"`
	Nickname           string    `bson:"nickname" json:"nickname"`
	FirstName          string    `bson:"firstName" json:"first_name"`
	LastName           string    `bson:"lastName" json:"last_name"`
	Position           string    `bson:"position" json:"position"`
	Roles              string    `bson:"roles" json:"roles"`
	AllowMarketing     bool      `bson:"allowMarketing" json:"allow_marketing,omitempty"`
	Props              StringMap `bson:"props" json:"props,omitempty"`
	NotifyProps        StringMap `bson:"notifyProps" json:"notify_props,omitempty"`
	LastPasswordUpdate int64     `bson:"lastPasswordUpdate" json:"last_password_update,omitempty"`
	LastPictureUpdate  int64     `bson:"lastPictureUpdate" json:"last_picture_update,omitempty"`
	FailedAttempts     int       `bson:"failedAttempts" json:"failed_attempts,omitempty"`
	Locale             string    `bson:"locale" json:"locale"`
	MfaActive          bool      `bson:"mfaActive" json:"mfa_active,omitempty"`
	MfaSecret          string    `bson:"mfaSecret" json:"mfa_secret,omitempty"`
	LastActivityAt     int64     `bson:"-" db:"-" json:"last_activity_at,omitempty"`
	Names              []string  `bson:"names,omitempty" db:"-" json:"-"`
	HasTeams           bool      `bson:"hasTeams" db:"-" json:"-"`
	HeadImgUrl         string    `bson:"headImgUrl" json:"-"`
	Mobile             string    `bson:"mobile" json:"mobile"`
	IconUrl            string    `bson:"icon_url" json:"icon_url"`
	IdCard             string    `bson:"id_card" json:"id_card"`
	Education          string    `bson:"education" json:"education"`
	GraduateSchool     string    `bson:"graduate_school" json:"graduate_school"`
	TeachingGrade      string    `bson:"teaching_grade" json:"teaching_grade"`
	Introduce          string    `bson:"introduce" json:"introduce"`
	Interest           string    `bson:"interest" json:"interest"`
	Professional       string    `bson:"professional" json:"professional"`
	ReviewResult       string    `bson:"review_result" json:"review_result"`
	Status             int       `bson:"status" json:"status"`
	CreatedAt          int64     `bson:"created_at" json:"created_at"`
}

func DecodeUserFromJson

func DecodeUserFromJson(data io.Reader) *User

func UserFromJson

func UserFromJson(data string) *User

func UserListFromJson

func UserListFromJson(data io.Reader) []*User

func (*User) ClearNonProfileFields

func (u *User) ClearNonProfileFields()

func (*User) Etag

func (u *User) Etag(showFullName, showEmail bool) string

func (*User) GetDisplayName

func (u *User) GetDisplayName() string

func (*User) GetFullName

func (u *User) GetFullName() string

func (*User) IsOAuthUser

func (u *User) IsOAuthUser() bool

func (*User) IsValid

func (u *User) IsValid() *AppError

func (*User) MakeNonNil

func (u *User) MakeNonNil()

func (*User) PreSave

func (u *User) PreSave()

func (*User) PreUpdate

func (u *User) PreUpdate()

func (*User) Sanitize

func (u *User) Sanitize(options map[string]bool)

func (*User) SanitizeProfile

func (u *User) SanitizeProfile(options map[string]bool)

func (*User) SetNames

func (u *User) SetNames()

func (*User) ToJson

func (u *User) ToJson() string

func (*User) UpdateMentionKeysFromUsername

func (user *User) UpdateMentionKeysFromUsername(oldUsername string)

type UserSearch

type UserSearch struct {
	Term          string `json:"term"`
	AllowInactive bool   `json:"allow_inactive"`
}

func UserSearchFromJson

func UserSearchFromJson(data io.Reader) *UserSearch

UserSearchFromJson will decode the input and return a User

func (*UserSearch) ToJson

func (u *UserSearch) ToJson() string

ToJson convert a User to a json string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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