Fix: Properly handle global site_uuid and dynamic env for BACKONE_SITE_UUIDS
This commit is contained in:
1 parent
8dd8432c29
commit
e7c9870e59
2 files changed
+13
-6
No files matched your search
@@ -21,7 +21,7 @@ export default function UptimeStatsCards({
|
|||||||
<div className="absolute top-0 right-0 p-3 opacity-10 group-hover:opacity-20 transition-opacity">
|
<div className="absolute top-0 right-0 p-3 opacity-10 group-hover:opacity-20 transition-opacity">
|
||||||
<Server className="w-12 h-12 text-blue-400" />
|
<Server className="w-12 h-12 text-blue-400" />
|
||||||
</div>
|
</div>
|
||||||
<span className="text-slate-400 uppercase tracking-wider mb-1 text-[10px] font-medium">TOTAL AGENTS (V6)</span>
|
<span className="text-slate-400 uppercase tracking-wider mb-1 text-[10px] font-medium">TOTAL AGENTS</span>
|
||||||
<span className="text-2xl font-bold text-white tracking-tight">{totalAgents}</span>
|
<span className="text-2xl font-bold text-white tracking-tight">{totalAgents}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="bg-slate-900/50 backdrop-blur-sm border border-slate-800/80 p-5 rounded-2xl flex flex-col relative overflow-hidden group">
|
<div className="bg-slate-900/50 backdrop-blur-sm border border-slate-800/80 p-5 rounded-2xl flex flex-col relative overflow-hidden group">
|
||||||
|
|||||||
@@ -13,13 +13,20 @@ export async function fetchAgentsFromMongo(
|
|||||||
|
|
||||||
const filter: any = {};
|
const filter: any = {};
|
||||||
|
|
||||||
if (!isCompanyRole) {
|
if (!isCompanyRole && SITE_UUID) {
|
||||||
// BRUTE FORCE OVERRIDE for SUPER_ADMIN:
|
if (SITE_UUID === 'all' || SITE_UUID === 'test-site' || SITE_UUID === 'default' || SITE_UUID === 'global') {
|
||||||
// ALWAYS force the filter to this exact site + global to prove if this code runs.
|
const dynamicEnv = process['env'];
|
||||||
filter.site_uuid = { $in: ['6681452d_9cae_4ff4_8ae8_0d504774265e', 'global'] };
|
const envSites = (dynamicEnv.BACKONE_SITE_UUIDS || dynamicEnv.BACKONE_SITE_UUID || '').split(',').map(s => s.trim()).filter(Boolean);
|
||||||
|
|
||||||
|
if (envSites.length > 0) {
|
||||||
|
filter.site_uuid = { $in: [...envSites, 'global'] };
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
filter.site_uuid = { $in: [SITE_UUID, 'global'] };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("V5 EXECUTING! BRUTE FORCED FILTER:", JSON.stringify(filter));
|
|
||||||
|
|
||||||
if (user.role === 'AGENT_VIEWER' && user.agent_uuid) {
|
if (user.role === 'AGENT_VIEWER' && user.agent_uuid) {
|
||||||
filter.uuid = user.agent_uuid;
|
filter.uuid = user.agent_uuid;
|
||||||
|
|||||||
Reference in new issue
Block a user