Added migration methods available to admins

This commit is contained in:
Stefan Zermatten
2015-04-23 10:00:31 +02:00
parent 21dfc5d086
commit 895a099b9b
2 changed files with 25 additions and 1 deletions

3
rpg-docs/.gitignore vendored
View File

@@ -1,4 +1,5 @@
.meteor/local
.meteor/meteorite
public/components
nohup.out
nohup.out
dump

View File

@@ -1,3 +1,26 @@
Meteor.methods({
getVersion: function() {
return Migrations.getVersion();
},
migrateTo: function(versionNumber) {
var user = Meteor.users.findOne(this.userId);
if (!user){
throw new Meteor.Error(
"logged-out",
"The user must be logged in to migrate the database"
);
}
if (_.contains(user.roles, "admin")){
Migrations.migrateTo(versionNumber);
} else {
throw new Meteor.Error(
"not admin",
"The user must be an administrator to migrate the database"
);
}
}
});
Migrations.add({
version: 1,
name: "converts effect proficiencies to proficiency objects, removes types from assets",