Vulcan/collections/categories.js

16 lines
419 B
JavaScript
Raw Normal View History

2013-04-13 15:05:18 +09:00
Categories = new Meteor.Collection('categories');
2013-07-04 12:51:26 +09:00
Categories.allow({
insert: isAdminById
, update: isAdminById
, remove: isAdminById
});
Meteor.methods({
category: function(category){
2013-07-05 07:09:15 +09:00
if (!Meteor.user() || !isAdmin(Meteor.user()))
2013-11-11 22:07:19 +01:00
throw new Meteor.Error(i18n.t('You need to login and be an admin to add a new category.'))
var categoryId=Categories.insert(category);
return category.name;
}
});