import{a as p,b as R}from"./chunk-ZSHAELBT.js";import{k as l,l as g}from"./chunk-6G52AAKU.js";import{P as m,Q as T}from"./chunk-JE2X3YFA.js";import{q as u,v as b}from"./chunk-HW6LKGMV.js";import{$b as U,Oj as i,Pj as q,_b as o}from"./chunk-GDJMZZ4C.js";import{Rd as O,sa as h,xa as n}from"./chunk-4HFZZ7HS.js";import{e as y}from"./chunk-SZAW6ZBW.js";var k,F,j=y(()=>{R();U();q();O();b();T();g();k=(()=>{class s{constructor(e,r,t){this.router=e,this.currentUserService=r,this.repositoryService=t}canActivate(e,r){let t=e.data.permissions,d=e.data.securables,v=e.data.appliesOnlyToPamVaults,P=e.data.isRepositoryDependant,f=e.data.excludePrivateVault,S=e.data.isPamProviderDependant,a=!1;return P&&(v?a=this.repositoryService.getCurrentUserRepositoriesSnapshot().filter(c=>c.isPamVault).some(c=>t.some(A=>this.currentUserService.hasPermission(A,o.Repository,c.id))):a=this.hasAtLeastOneOfTheRequiredRepositoryPermission(t,!f)),S&&(a=this.hasAtLeastOneOfTheRequiredPamProviderPermission(t)),a||(a=d?.length>0?this.hasAtLeastOneOfTheRequiredSecurable(d):this.hasAtLeastOneOfTheRequiredPermission(t)),a||this.router.navigate([p.location+"dashboard"]),a}hasAtLeastOneOfTheRequiredPermission(e){return e?.some(r=>this.currentUserService.hasPermission(r))}hasAtLeastOneOfTheRequiredPamProviderPermission(e){return e?.some(r=>this.currentUserService.hasPermissionGlobalOrAnyScoped(r,o.PamProvider))}hasAtLeastOneOfTheRequiredRepositoryPermission(e,r){return e?.some(t=>this.currentUserService.hasPermissionGlobalOrAnyScoped(t,o.Repository,r))}hasAtLeastOneOfTheRequiredSecurable(e){return e?.some(r=>this.currentUserService.hasAnyPermissionOnSecurable(r))}static{this.\u0275fac=function(r){return new(r||s)(n(u),n(m),n(l))}}static{this.\u0275prov=h({token:s,factory:s.\u0275fac,providedIn:"root"})}}return s})(),F=(()=>{class s{constructor(e,r){this.router=e,this.currentUserService=r}canActivate(e,r){switch(e.data.page){case i.Dashboard:return!0;case i.Vault:return!0;case i.PrivateVault:return this.currentUserService.sectionAccessSnapshot.hasAccessPrivateVault;case i.Reports:return this.currentUserService.sectionAccessSnapshot.hasAccessReports;case i.Administration:return this.currentUserService.sectionAccessSnapshot.hasAccessAdmin;case i.Pam:return this.currentUserService.sectionAccessSnapshot.hasAccessPam;case i.SystemDashboard:return this.currentUserService.sectionAccessSnapshot.hasAccessSystemDashboard}}static{this.\u0275fac=function(r){return new(r||s)(n(u),n(m))}}static{this.\u0275prov=h({token:s,factory:s.\u0275fac,providedIn:"root"})}}return s})()});export{k as a,F as b,j as c};
