MCPcopy Index your code
hub / github.com/apache/answer / GetLoginUserIDFromContext

Function GetLoginUserIDFromContext

internal/base/middleware/auth.go:270–276  ·  view source on GitHub ↗

GetLoginUserIDFromContext get user id from context

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

268
269// GetLoginUserIDFromContext get user id from context
270func GetLoginUserIDFromContext(ctx *gin.Context) (userID string) {
271 userInfo := GetUserInfoFromContext(ctx)
272 if userInfo == nil {
273 return ""
274 }
275 return userInfo.UserID
276}
277
278// GetIsAdminFromContext get user is admin from context
279func GetIsAdminFromContext(ctx *gin.Context) (isAdmin bool) {

Callers 15

AddAPIKeyMethod · 0.92
UpdateAPIKeyMethod · 0.92
DeleteAPIKeyMethod · 0.92
UpdateUserStatusMethod · 0.92
UpdateUserRoleMethod · 0.92
AddUserMethod · 0.92
UpdateUserPasswordMethod · 0.92
UpdateSiteTagMethod · 0.92
CollectionSwitchMethod · 0.92
GetUnreviewedPostPageMethod · 0.92
UpdateReviewMethod · 0.92
RemoveTagMethod · 0.92

Calls 1

GetUserInfoFromContextFunction · 0.85

Tested by

no test coverage detected