MCPcopy Index your code
hub / github.com/53AI/53AIHub / setUserSession

Function setUserSession

api/middleware/auth.go:101–111  ·  view source on GitHub ↗
(c *gin.Context, user *model.User, tokenEid int64)

Source from the content-addressed store, hash-verified

99}
100
101func setUserSession(c *gin.Context, user *model.User, tokenEid int64) {
102 if c == nil || user == nil {
103 return
104 }
105 c.Set(session.SESSION_USER_ID, user.UserID)
106 c.Set(session.SESSION_USER_NICKNAME, user.Nickname)
107 c.Set(session.SESSION_USER_ROLE, user.Role)
108 c.Set(session.SESSION_USER_GROUP_ID, user.GroupId)
109 c.Set(session.ENV_EID, tokenEid)
110 c.Set(session.SESSION_SAAS_USER, false)
111}
112
113func HandleTokenAuth(token string, role int64) (user *model.User, tokenEid int64, err error) {
114 user_id, tokenEid, err := jwt.UserParseJWT(token)

Callers 3

BatchUploadAuthFunction · 0.85
UserTokenAuthFunction · 0.85
OptionalUserTokenAuthFunction · 0.85

Calls 1

SetMethod · 0.80

Tested by

no test coverage detected