File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -840,11 +840,16 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
840840 } )
841841 ) ;
842842
843+ const pkField = resource . columns . find ( ( col ) => col . primaryKey ) ?. name ;
843844 // remove all columns which are not defined in resources, or defined but backendOnly
844845 data . data . forEach ( ( item ) => {
845846 Object . keys ( item ) . forEach ( ( key ) => {
846- console . log ( visibleColumns ?. [ key ] , key ) ;
847- if ( ! resource . columns . find ( ( col ) => col . name === key ) || resource . columns . find ( ( col ) => col . name === key && col . backendOnly ) || visibleColumns ?. [ key ] === false ) {
847+ const isPk = pkField && key === pkField ;
848+ const isUnknown = ! resource . columns . find ( ( col ) => col . name === key ) ;
849+ const isBackendOnly = resource . columns . find ( ( col ) => col . name === key && col . backendOnly ) ;
850+ const isHiddenByACL = visibleColumns ?. [ key ] === false ;
851+
852+ if ( isUnknown || isBackendOnly || ( isHiddenByACL && ! isPk ) ) {
848853 delete item [ key ] ;
849854 }
850855 } )
You can’t perform that action at this time.
0 commit comments