import { Meteor } from 'meteor/meteor'; import { Facts } from 'meteor/facts-base'; /* * alanning:roles removed (1.x is dead on Meteor 3 — crashes the whole client * bundle at load — and 4.x needs a data migration we don't want). Admin check * against the plain `user.roles` field, cached at startup: facts are * dev/admin instrumentation and the admin set essentially never changes. */ const adminIds = new Set(); Meteor.startup(async () => { await Meteor.users .find({ roles: 'admin' }, { fields: { _id: 1 } }) .forEachAsync(u => adminIds.add(u._id)); }); Facts.setUserIdFilter(userId => adminIds.has(userId));