MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / LoadOperationUser

Function LoadOperationUser

core/middleware/operation.go:184–201  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

182}
183
184func LoadOperationUser(c *gin.Context) string {
185 sessionUser, ok := c.Get(psessionUtils.GinContextSessionUserKey)
186 if ok {
187 psession, ok := sessionUser.(psessionUtils.SessionUser)
188 if ok {
189 return psession.Name
190 }
191 }
192 apiUsername, ok := c.Get("API_AUTH_USERNAME")
193 if !ok {
194 return ""
195 }
196 username, ok := apiUsername.(string)
197 if !ok {
198 return ""
199 }
200 return username
201}
202
203func fillOperationDetail(operationDic *operationJson, formatMap map[string]interface{}) {
204 for key, value := range formatMap {

Callers 1

OperationLogFunction · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected