Skip to content

Commit

Permalink
modify a clone request data when resolving the auth record response
Browse files Browse the repository at this point in the history
  • Loading branch information
ganigeorgiev committed Nov 17, 2022
1 parent 39408f1 commit 0b54d17
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apis/record_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Binary file modified tests/data/logs.db
Binary file not shown.

0 comments on commit 0b54d17

Please sign in to comment.