Vulcan/collections/categories.js
2013-07-05 07:09:15 +09:00

16 lines
No EOL
412 B
JavaScript

Categories = new Meteor.Collection('categories');
Categories.allow({
insert: isAdminById
, update: isAdminById
, remove: isAdminById
});
Meteor.methods({
category: function(category){
if (!Meteor.user() || !isAdmin(Meteor.user()))
throw new Meteor.Error('You need to login and be an admin to add a new category.')
var categoryId=Categories.insert(category);
return category.name;
}
});