2022-08-04 19:50:18 -05:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
2024-07-27 13:47:46 -05:00
|
|
|
import { SysConfig } from '../imports/api/systemConfig';
|
2024-07-29 16:58:08 -05:00
|
|
|
import { MenuItems } from '../imports/api/menuItems';
|
2022-08-04 19:50:18 -05:00
|
|
|
|
|
|
|
|
Meteor.startup(() => {
|
|
|
|
|
// code to run on server at startup
|
2022-08-05 16:55:56 -05:00
|
|
|
Roles.createRole("user", {unlessExists: true});
|
2022-08-04 19:50:18 -05:00
|
|
|
Roles.createRole("admin", {unlessExists: true});
|
|
|
|
|
Roles.createRole("systemadmin", {unlessExists: true});
|
2024-07-27 13:47:46 -05:00
|
|
|
|
|
|
|
|
// set the systemconfig defaults for registration
|
|
|
|
|
let regPolicy = SysConfig.findOne({});
|
|
|
|
|
if (typeof regPolicy == 'undefined') {
|
|
|
|
|
return SysConfig.insert({
|
|
|
|
|
SysAdminReg: false,
|
|
|
|
|
dateAdded: new Date(),
|
|
|
|
|
allowReg: true,
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
console.log("Registration policy already set.");
|
|
|
|
|
}
|
2024-07-29 16:58:08 -05:00
|
|
|
|
|
|
|
|
// check if the isLInked item exists on menuitems, and if not, add it (data cleanup task)
|
|
|
|
|
let itemInfoNoLink = MenuItems.find({ isLinked: { $exists: false } }).fetch();
|
|
|
|
|
console.log("No Ites with isLinked not set: " + itemInfoNoLink.length);
|
|
|
|
|
if (itemInfoNoLink.length > 0) {
|
|
|
|
|
console.log("found items with isLinked not set.");
|
|
|
|
|
console.dir(itemInfoNoLink);
|
|
|
|
|
let infoLength = itemInfoNoLink.length;
|
|
|
|
|
for (i=0; i < infoLength; i++) {
|
|
|
|
|
MenuItems.update({ _id: itemInfoNoLink[i]._id }, {
|
|
|
|
|
$set: {
|
|
|
|
|
isLinked: false,
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// this will show if all items are found to have isLInked set.
|
|
|
|
|
console.log("No itesm with isLinked not set.");
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-04 19:50:18 -05:00
|
|
|
});
|