Vulcan/packages/nova-settings/lib/server/publications.js

29 lines
764 B
JavaScript
Raw Normal View History

2016-06-23 15:00:58 +09:00
import Users from 'meteor/nova:users';
2016-04-21 15:09:03 +09:00
// Meteor.publish('settings', function() {
// var options = {};
// var privateFields = {};
2016-04-21 15:09:03 +09:00
// // look at Settings.simpleSchema._schema to see which fields should be kept private
// _.each(Telescope.settings.collection.simpleSchema()._schema, (property, key) => {
// if (property.private)
// privateFields[key] = false;
// });
2016-04-21 15:09:03 +09:00
// options = _.extend(options, {
// fields: privateFields
// });
2016-04-21 15:09:03 +09:00
// return Telescope.settings.collection.find({}, options);
// });
Telescope.settings.collection.smartPublish('settings');
2016-04-15 11:11:13 +09:00
Meteor.publish('settings.admin', function() {
2016-07-21 14:51:58 +09:00
if (Users.isAdminById(this.userId)) {
2016-04-15 11:11:13 +09:00
return Telescope.settings.collection.find({}, {});
} else {
return [];
}
});