Vulcan/server/toolbox.js
2013-10-24 11:04:27 +09:00

25 lines
No EOL
721 B
JavaScript

Meteor.methods({
updateCategories: function () {
if(isAdmin(Meteor.user())){
Posts.find().forEach(function(post){
if(post.categories){
console.log('Found categories for post "'+post.headline+'"');
Posts.update(post._id,{$set:{userId:post.user_id}}, function(error){
console.log(error);
});
}
});
}
},
giveInvites: function () {
if(isAdmin(Meteor.user()))
Meteor.users.update({}, {$inc:{invitesCount: 1}}, {multi:true});
},
updateUserSlugs: function () {
if(isAdmin(Meteor.user())){
Meteor.users.find().forEach(function(user){
Meteor.users.update(user._id, {$set:{'profile.slug': slugify(getDisplayName(user))}});
});
}
}
})