Vulcan/collections/categories.js
2013-07-04 12:51:26 +09:00

20 lines
No EOL
430 B
JavaScript

Categories = new Meteor.Collection('categories');
Categories.allow({
insert: isAdminById
, update: isAdminById
, remove: isAdminById
});
Meteor.methods({
category: function(category){
var user = Meteor.user();
if (!user || !isAdmin(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;
}
});