From 9bf8001f41e8fd477180eff8f31e7a70ca447ce0 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Wed, 17 Apr 2024 12:25:36 +0300 Subject: [PATCH] Fix sandbox guard stakeholder in data. --- src/app/shared/sandbox.guard.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/shared/sandbox.guard.ts b/src/app/shared/sandbox.guard.ts index 77dd1cc..ce740fd 100644 --- a/src/app/shared/sandbox.guard.ts +++ b/src/app/shared/sandbox.guard.ts @@ -24,7 +24,13 @@ export class SandboxGuard { if (childRoute.data['researcher'] && childRoute.params.stakeholder && sandbox) { return this.checkResearcher(state.url, childRoute.params.stakeholder); } else { - return !sandbox || this.check(state.url, childRoute.data?.stakeholder?childRoute.data.stakeholder:childRoute.params.stakeholder); + let alias = childRoute.params.stakeholder; + let route = childRoute; + while (!alias && route) { + alias = route.data.stakeholder; + route = route.parent; + } + return !sandbox || this.check(state.url, alias); } }