{ "version": 3, "sources": ["src/app/guards/permission-guard.service.ts"], "sourcesContent": ["import { Injectable } from '@angular/core';\nimport { ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree, Router } from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {map} from 'rxjs/operators';\n\nimport {RoutingService} from '../services/routing.service';\nimport {PermissionService} from '../permission/permission.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class PermissionGuard {\n constructor(private permissionService: PermissionService,\n private router: Router,\n private routingService: RoutingService) {\n }\n\n canActivate(\n route: ActivatedRouteSnapshot,\n state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree {\n const { minimumPermissionLevel, minimumFinancialPermissionLevel, requiredSectionsAccess } = route.data;\n return this.permissionService.checkPermission(minimumPermissionLevel, minimumFinancialPermissionLevel, requiredSectionsAccess).pipe(\n map(([allowed, _]) => {\n return allowed ?\n true :\n this.router.parseUrl(this.routingService.noAccess);\n })\n );\n }\n\n}\n"], "mappings": "iHAWA,IAAaA,GAAe,IAAA,CAAtB,IAAOA,EAAP,MAAOA,CAAe,CAC1BC,YAAoBC,EACAC,EACAC,EAA8B,CAF9B,KAAAF,kBAAAA,EACA,KAAAC,OAAAA,EACA,KAAAC,eAAAA,CACpB,CAEAC,YACEC,EACAC,EAA0B,CAC1B,GAAM,CAAEC,uBAAAA,EAAwBC,gCAAAA,EAAiCC,uBAAAA,CAAsB,EAAKJ,EAAMK,KAClG,OAAO,KAAKT,kBAAkBU,gBAAgBJ,EAAwBC,EAAiCC,CAAsB,EAAEG,KAC7HC,EAAI,CAAC,CAACC,EAASC,CAAC,IACPD,EACA,GACA,KAAKZ,OAAOc,SAAS,KAAKb,eAAec,QAAQ,CACzD,CAAC,CAEN,yCAjBWlB,GAAemB,EAAAC,CAAA,EAAAD,EAAAE,CAAA,EAAAF,EAAAG,CAAA,CAAA,CAAA,wBAAftB,EAAeuB,QAAfvB,EAAewB,UAAAC,WAFd,MAAM,CAAA,EAEd,IAAOzB,EAAP0B,SAAO1B,CAAe,GAAA", "names": ["PermissionGuard", "constructor", "permissionService", "router", "routingService", "canActivate", "route", "state", "minimumPermissionLevel", "minimumFinancialPermissionLevel", "requiredSectionsAccess", "data", "checkPermission", "pipe", "map", "allowed", "_", "parseUrl", "noAccess", "\u0275\u0275inject", "PermissionService", "Router", "RoutingService", "factory", "\u0275fac", "providedIn", "_PermissionGuard"] }