adminforth 1.3.34 → 1.3.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/restApi.js +5 -3
- package/modules/restApi.ts +5 -3
- package/package.json +1 -1
package/dist/modules/restApi.js
CHANGED
|
@@ -594,9 +594,11 @@ export default class AdminForthRestAPI {
|
|
|
594
594
|
if (!action) {
|
|
595
595
|
return { error: `Action '${actionId}' not found` };
|
|
596
596
|
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
597
|
+
if (action.allowed) {
|
|
598
|
+
const execAllowed = yield action.allowed({ adminUser, resource, selectedIds: recordIds, allowedActions });
|
|
599
|
+
if (!execAllowed) {
|
|
600
|
+
return { error: `Action '${actionId}' is not allowed` };
|
|
601
|
+
}
|
|
600
602
|
}
|
|
601
603
|
const response = yield action.action({ selectedIds: recordIds, adminUser, resource });
|
|
602
604
|
return Object.assign({ actionId,
|
package/modules/restApi.ts
CHANGED
|
@@ -687,9 +687,11 @@ export default class AdminForthRestAPI {
|
|
|
687
687
|
return { error: `Action '${actionId}' not found` };
|
|
688
688
|
}
|
|
689
689
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
690
|
+
if (action.allowed) {
|
|
691
|
+
const execAllowed = await action.allowed({ adminUser, resource, selectedIds: recordIds, allowedActions });
|
|
692
|
+
if (!execAllowed) {
|
|
693
|
+
return { error: `Action '${actionId}' is not allowed` };
|
|
694
|
+
}
|
|
693
695
|
}
|
|
694
696
|
const response = await action.action({selectedIds: recordIds, adminUser, resource});
|
|
695
697
|
|