@@ -35,12 +35,13 @@ export default class ForeignInlineListPlugin extends AdminForthPlugin {
3535 }
3636 // exclude "plugins" key
3737 const resourceCopy = JSON . parse ( JSON . stringify ( { ...resource , plugins : undefined } ) ) ;
38- const { allowedActions } = await interpretResource ( adminUser , resource , { } , ActionCheckSource . DisplayButtons , this . adminforth ) ;
3938
40-
4139 if ( this . options . modifyTableResourceConfig ) {
4240 this . options . modifyTableResourceConfig ( resourceCopy ) ;
4341 }
42+
43+ const { allowedActions } = await interpretResource ( adminUser , resourceCopy , { } , ActionCheckSource . DisplayButtons , this . adminforth ) ;
44+
4445 return {
4546 resource : {
4647 ...resourceCopy ,
@@ -63,32 +64,32 @@ export default class ForeignInlineListPlugin extends AdminForthPlugin {
6364 }
6465
6566 const resourceCopy = JSON . parse ( JSON . stringify ( { ...resource , plugins : undefined } ) ) ;
67+
68+
69+ if ( this . options . modifyTableResourceConfig ) {
70+ this . options . modifyTableResourceConfig ( resourceCopy ) ;
71+ }
6672
6773 const { allowedActions } = await interpretResource (
6874 adminUser ,
69- resource ,
75+ resourceCopy ,
7076 { requestBody : body } ,
7177 ActionCheckSource . BulkActionRequest ,
7278 this . adminforth
7379 ) ;
7480
75- if ( this . options . modifyTableResourceConfig ) {
76- this . options . modifyTableResourceConfig ( resourceCopy ) ;
77- }
78-
7981 const action = resourceCopy . options . bulkActions . find ( ( act ) => act . id == actionId ) ;
80- console . log ( 'action' , JSON . stringify ( resourceCopy . options . bulkActions , null , 2 ) ) ;
8182 if ( ! action ) {
8283 return { error : await tr ( `Action {actionId} not found` , 'errors' , { actionId } ) } ;
8384 }
8485
8586 if ( action . allowed ) {
86- const execAllowed = await action . allowed ( { adminUser, resource , selectedIds : recordIds , allowedActions } ) ;
87+ const execAllowed = await action . allowed ( { adminUser, resourceCopy , selectedIds : recordIds , allowedActions } ) ;
8788 if ( ! execAllowed ) {
8889 return { error : await tr ( `Action "{actionId}" not allowed` , 'errors' , { actionId : action . label } ) } ;
8990 }
9091 }
91- const response = await action . action ( { selectedIds : recordIds , adminUser, resource , tr} ) ;
92+ const response = await action . action ( { selectedIds : recordIds , adminUser, resourceCopy , tr} ) ;
9293
9394 return {
9495 actionId,
0 commit comments