import{RBAC_ALL_OTHER_TEAMS as c}from"../../../../constants/common.js";const g=["read","triage","write","maintain","admin"],r=["write","maintain","admin"];function E({rbacConfig:i,currentRbacTeams:s,accessLevel:n="READ"}){const a=[],f=[],e=[];if(n==="READ")for(const[t,o]of Object.entries(i?.entitiesCatalog?.catalogs??{}))o&&(l(o,s,n)||a.push(t));for(const[t,o]of Object.entries(i?.entitiesCatalog?.entitiesTypes??{}))o&&(l(o,s,n)||f.push(t));i?.entitiesCatalog?.entitiesGroups?.forEach(t=>{l(t.config,s,n)||e.push(...t.entities??[])});for(const[t,o]of Object.entries(i?.entitiesCatalog?.entities??{}))o&&(l(o,s,n)||e.push(t));return{catalogs:[...new Set(a)],types:[...new Set(f)],entities:[...new Set(e)]}}function l(i,s,n){const a=i[c],f=n==="WRITE"?r:g,e=[];for(const t of s)i[t]?e.push(i[t]):a&&e.push(a);return e.length>0&&e.some(t=>f.includes(t.toLowerCase()))}export{E as getNotAccessibleCatalogResources};
