1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-04-13 20:50:41 +02:00

modify a clone request data when resolving the auth record response

This commit is contained in:
Gani Georgiev 2022-11-17 14:27:54 +02:00
parent 39408f135b
commit 0b54d1736e
2 changed files with 3 additions and 2 deletions

View File

@ -71,13 +71,14 @@ func (api *recordAuthApi) authResponse(c echo.Context, authRecord *models.Record
// expand record relations
expands := strings.Split(c.QueryParam(expandQueryParam), ",")
if len(expands) > 0 {
requestData := GetRequestData(e.HttpContext)
// create a copy of the cached request data and adjust it to the current auth record
requestData := *GetRequestData(e.HttpContext)
requestData.Admin = nil
requestData.AuthRecord = e.Record
failed := api.app.Dao().ExpandRecord(
e.Record,
expands,
expandFetch(api.app.Dao(), requestData),
expandFetch(api.app.Dao(), &requestData),
)
if len(failed) > 0 && api.app.IsDebug() {
log.Println("Failed to expand relations: ", failed)

Binary file not shown.