fix: resolve function-valued backendOnly and project the record it re… - #2
fix: resolve function-valued backendOnly and project the record it re…#2Romsik788 wants to merge 2 commits into
Conversation
|
|
||
| const updatedRecord = await connector.getRecordByPrimaryKey(resource, recordId as string); | ||
| if (updatedRecord) { | ||
| await stripBackendOnly(updatedRecord, { ...editCtx, meta: { requestBody: body, pk: recordId }, source: ActionCheckSource.EditLoadRequest }); |
There was a problem hiding this comment.
@Romsik788 I see that logic here changes from validation at start of update, to a setting bcakendOnly after hooks executed? But Why? Setting backendOnly field in hook is fine and always was core concept. Please test this plugin on inplace edit for password field for example - I feel liek it will not set password hash because this will totally strip it
There was a problem hiding this comment.
The main idea it's moving some checks to one side (adminforth core). Because it has a lot of the same code in different plugins and we need to maintain it (instead of maintaining one place).
I feel liek it will not set password hash because this will totally strip it
Please look 112 line.
There was a problem hiding this comment.
https://github.com/devforth/adminforth-list-in-place-edit/blob/main/index.ts#L85
Here's good example in this plugin. Now it has a bug with checking of backendOnly. Because backendOnly can be function.
There was a problem hiding this comment.
112 line in this file (https://github.com/devforth/adminforth-list-in-place-edit/pull/2/changes/BASE..083537ff4bbebe28c89443c02fd1a0d6d973bce3#diff-dcdc3e0b3362edb8fec2a51d3fa51f8fb8af8f70247e06d9887fa934834c9122R112)
devforth/adminforth#717 - in this PR you find an implementation of these helpers functions.
| if (updatedRecord) { | ||
| await stripBackendOnly(updatedRecord, { ...editCtx, meta: { requestBody: body, pk: recordId }, source: ActionCheckSource.EditLoadRequest }); | ||
| // _label is not a declared column, so stripBackendOnly would drop it: set it after | ||
| updatedRecord._label = resource.recordLabel(updatedRecord); |
There was a problem hiding this comment.
This also sounds like some sort of workaround for me, like indirect code might be hardread
There was a problem hiding this comment.
updatedRecord._label = resource.recordLabel(updatedRecord); was deleted

…turns