mirror of
https://github.com/vale981/Vulcan
synced 2025-03-08 19:11:38 -05:00
20 lines
No EOL
430 B
JavaScript
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;
|
|
}
|
|
}); |