alanning:roles removed (client crashed the whole bundle; plain user.roles checks instead), selaias:cookie-consent replaced by in-repo React banner, publish-performant-counts vendored with countAsync, Meteor.autorun dropped (App)/Tracker.autorun (FiresMap), and the map publications not covered by the REST smoke (activefiresmyloc, activefiresunionmyloc, fireAlerts, oauth.verifyConfiguration) converted to async APIs. Verified in browser: / and /fires render with map + cookie banner, zero uncaught exceptions. REST smoke byte-identical (12/12).
18 lines
634 B
JavaScript
18 lines
634 B
JavaScript
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));
|