2018-07-30 14:15:39 -07:00
|
|
|
|
|
|
|
|
import Users from "./User.js";
|
|
|
|
|
import UserRoles from "./Roles.js";
|
2018-08-17 11:24:00 -07:00
|
|
|
import Pages from "./Page.js";
|
2018-12-12 11:04:00 -08:00
|
|
|
import ImageUploads from "./Images.js";
|
|
|
|
|
import Slideshow from "./Slideshow.js";
|
|
|
|
|
import Internship from "./Internship.js";
|
2018-08-23 16:58:50 -07:00
|
|
|
import ContactUsMessages from "./ContactUsMessages.js";
|
2020-01-16 09:32:59 -08:00
|
|
|
import Settings from "./Settings.js";
|
2018-07-30 14:15:39 -07:00
|
|
|
|
|
|
|
|
//Save the collections in the Meteor.collections property for easy access without name conflicts.
|
2020-01-16 09:32:59 -08:00
|
|
|
Meteor.collections = {Users, UserRoles, Pages, Slideshow, Internship, ContactUsMessages, ImageUploads, Settings};
|
2018-07-30 14:15:39 -07:00
|
|
|
|
|
|
|
|
//If this is the server then setup the default admin user if none exist.
|
|
|
|
|
if(Meteor.isServer) {
|
|
|
|
|
//Change this to find admin users, create a default admin user if none exists.
|
|
|
|
|
if(Users.find({}).count() == 0) {
|
|
|
|
|
try {
|
|
|
|
|
console.log("Creating a default admin user: admin/admin");
|
|
|
|
|
|
|
|
|
|
let id = Accounts.createUser({password: 'admin', username: 'admin'});
|
|
|
|
|
//Requires the alanning:roles package.
|
|
|
|
|
Roles.addUsersToRoles(id, [Meteor.UserRoles.ROLE_MANAGE, Meteor.UserRoles.ROLE_UPDATE]);
|
|
|
|
|
}
|
|
|
|
|
catch(err) {
|
|
|
|
|
console.log(err);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|