- user GetUserTag in jxcontext.Context.GetUserName

This commit is contained in:
gazebo
2019-03-12 17:08:41 +08:00
parent 6693bd4bf5
commit 8ce4ee0be9
3 changed files with 19 additions and 1 deletions

View File

@@ -17,6 +17,7 @@ import (
type IAuther interface {
GetAuthID() string
GetAuthType() string
GetUserTag() string
}
type Context struct {
@@ -96,7 +97,7 @@ func New(rootTask tasksch.ITask, token string, w http.ResponseWriter, r *http.Re
func (ctx *Context) GetUserName() string {
userName := ctx.token
if ctx.userInfo != nil {
userName = ctx.userInfo.GetAuthID()
userName = ctx.userInfo.GetUserTag()
}
if len(userName) > MaxUserNameLen {
userName = userName[:MaxUserNameLen]