MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / getUserInfo

Function getUserInfo

cmd/cql-proxy/api/user_oauth.go:344–367  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

342}
343
344func getUserInfo(c *gin.Context) {
345 projectDB, err := getCurrentProjectDB(c)
346 if err != nil {
347 _ = c.Error(err)
348 abortWithError(c, http.StatusBadRequest, ErrLoadProjectDatabaseFailed)
349 return
350 }
351
352 userID := getUserID(c)
353 u, err := model.GetProjectUser(projectDB, userID)
354 if err != nil {
355 _ = c.Error(err)
356 abortWithError(c, http.StatusForbidden, ErrGetProjectUserFailed)
357 return
358 }
359
360 responseWithData(c, http.StatusOK, gin.H{
361 "name": u.Name,
362 "email": u.Email,
363 "extra": u.Extra,
364 "provider": u.Provider,
365 "provide_id": u.ProviderUID,
366 })
367}
368
369func userAuthLogout(c *gin.Context) {
370 err := model.DeleteSession(model.GetDB(c), getSession(c))

Callers

nothing calls this directly

Calls 6

GetProjectUserFunction · 0.92
getCurrentProjectDBFunction · 0.85
abortWithErrorFunction · 0.85
getUserIDFunction · 0.85
responseWithDataFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected