Skip to content

fix: resolve function-valued backendOnly and project the record it re… - #2

Open
Romsik788 wants to merge 2 commits into
mainfrom
column-access-helpers
Open

fix: resolve function-valued backendOnly and project the record it re…#2
Romsik788 wants to merge 2 commits into
mainfrom
column-access-helpers

Conversation

@Romsik788

Copy link
Copy Markdown

…turns

Comment thread index.ts

const updatedRecord = await connector.getRecordByPrimaryKey(resource, recordId as string);
if (updatedRecord) {
await stripBackendOnly(updatedRecord, { ...editCtx, meta: { requestBody: body, pk: recordId }, source: ActionCheckSource.EditLoadRequest });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

@Romsik788 Romsik788 Sep 10, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

devforth/adminforth#717

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Here is what I see

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread index.ts Outdated
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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also sounds like some sort of workaround for me, like indirect code might be hardread

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updatedRecord._label = resource.recordLabel(updatedRecord); was deleted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants