@ruiapp/rapid-core 0.9.9 → 0.9.11
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/index.js
CHANGED
|
@@ -4881,7 +4881,7 @@ class RapidRequest {
|
|
|
4881
4881
|
else if (contentType.startsWith("multipart/form-data")) {
|
|
4882
4882
|
this.#body = {
|
|
4883
4883
|
type: "form-data",
|
|
4884
|
-
value: await parseFormDataBody(req),
|
|
4884
|
+
value: await parseFormDataBody(req, { all: true }),
|
|
4885
4885
|
};
|
|
4886
4886
|
}
|
|
4887
4887
|
this.#bodyParsed = true;
|
|
@@ -9773,11 +9773,19 @@ class EntityAccessControlPlugin {
|
|
|
9773
9773
|
// Check permission
|
|
9774
9774
|
const { routerContext } = handlerContext;
|
|
9775
9775
|
const { routeConfig } = routerContext;
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9776
|
+
if (routeConfig.permissionCheck) {
|
|
9777
|
+
if (!isAccessAllowed(routeConfig.permissionCheck, routerContext.state.allowedActions || [])) {
|
|
9778
|
+
throw new Error(`Your request to route '${routeConfig.code}' is not permitted.`);
|
|
9779
|
+
}
|
|
9780
|
+
}
|
|
9781
|
+
const actions = routeConfig.actions;
|
|
9782
|
+
if (actions) {
|
|
9783
|
+
for (const actionConfig of routeConfig.actions) {
|
|
9784
|
+
const permissionCheck = actionConfig.config?.permissionCheck;
|
|
9785
|
+
if (permissionCheck) {
|
|
9786
|
+
if (!isAccessAllowed(permissionCheck, routerContext.state.allowedActions || [])) {
|
|
9787
|
+
throw new Error(`Your action of '${actionConfig.code}' is not permitted.`);
|
|
9788
|
+
}
|
|
9781
9789
|
}
|
|
9782
9790
|
}
|
|
9783
9791
|
}
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
package/src/core/request.ts
CHANGED
|
@@ -66,7 +66,7 @@ export class RapidRequest {
|
|
|
66
66
|
} else if (contentType.startsWith("multipart/form-data")) {
|
|
67
67
|
this.#body = {
|
|
68
68
|
type: "form-data",
|
|
69
|
-
value: await parseFormDataBody(req),
|
|
69
|
+
value: await parseFormDataBody(req, { all: true }),
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
this.#bodyParsed = true;
|
|
@@ -132,11 +132,20 @@ class EntityAccessControlPlugin implements RapidPlugin {
|
|
|
132
132
|
// Check permission
|
|
133
133
|
const { routerContext } = handlerContext;
|
|
134
134
|
const { routeConfig } = routerContext;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
if (routeConfig.permissionCheck) {
|
|
136
|
+
if (!isAccessAllowed(routeConfig.permissionCheck, routerContext.state.allowedActions || [])) {
|
|
137
|
+
throw new Error(`Your request to route '${routeConfig.code}' is not permitted.`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const actions = routeConfig.actions;
|
|
142
|
+
if (actions) {
|
|
143
|
+
for (const actionConfig of routeConfig.actions) {
|
|
144
|
+
const permissionCheck = actionConfig.config?.permissionCheck;
|
|
145
|
+
if (permissionCheck) {
|
|
146
|
+
if (!isAccessAllowed(permissionCheck, routerContext.state.allowedActions || [])) {
|
|
147
|
+
throw new Error(`Your action of '${actionConfig.code}' is not permitted.`);
|
|
148
|
+
}
|
|
140
149
|
}
|
|
141
150
|
}
|
|
142
151
|
}
|
package/src/types.ts
CHANGED