akanjs 2.4.1-rc.0 → 2.4.1-rc.2
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/package.json +1 -1
- package/signal/signalContext.ts +7 -5
package/package.json
CHANGED
package/signal/signalContext.ts
CHANGED
|
@@ -117,11 +117,13 @@ export class SignalContext<
|
|
|
117
117
|
async #checkGuards() {
|
|
118
118
|
const guards = this.endpointInfo.signalOption.guards ?? [];
|
|
119
119
|
if (guards.length === 0) return;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
await Promise.all(
|
|
121
|
+
guards.map(async (GuardCls) => {
|
|
122
|
+
const guard = new GuardCls();
|
|
123
|
+
const canPass = await guard.canPass(this);
|
|
124
|
+
if (!canPass) throw new Exception.Forbidden(`Access denied by guard: ${GuardCls.name}`);
|
|
125
|
+
}),
|
|
126
|
+
);
|
|
125
127
|
}
|
|
126
128
|
async exec() {
|
|
127
129
|
if (!this.trace) return await this.#exec();
|