Documentation ¶
Overview ¶
Package login implements all login management interfaces.
Index ¶
Constants ¶
View Source
const LoginSessionTimeoutMin = 120
Variables ¶
View Source
var ( UserTable map[string]*User UserLock sync.RWMutex )
权限等级 0-->admin; 1-->高级用户(agent读写+hub读写); 2-->agent读写;3-->agent只读;4-->hub读写;5-->hub只读
Functions ¶
func GetLoginSessionTimeoutMinute ¶
func GetLoginSessionTimeoutMinute() int64
GetLoginSessionTimeoutMinute returns the login session idle timeout time in minutes.
Types ¶
type User ¶
type User struct { Username string `json:"username" bson:"username"` Password string `json:"password" bson:"password"` Salt string `json:"salt" bson:"salt"` Avatar string `json:"avatar" bson:"avatar"` Level int `json:"level" bson:"level"` // 权限等级 0-->admin; 1-->高级用户(agent读写+hub读写); 2-->agent读写;3-->agent只读;4-->hub读写;5-->hub只读 Config []UserConfig `json:"config" bson:"config"` Xml bool `json:"xml" bson:"xml"` PasswordUpdateTime int64 `json:"password_update_time" bson:"password_update_time"` }
func GetUser ¶
GetUser find the user in the cache and returns, if user not exist, return nil. This interface is high-performance, but may not be up-to-date.
func GetUserFromDB ¶
GetUserFromDB find the user in db and returns, if user not exist, return nil.
type UserConfig ¶
Click to show internal directories.
Click to hide internal directories.