Added migration methods available to admins
This commit is contained in:
3
rpg-docs/.gitignore
vendored
3
rpg-docs/.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
.meteor/local
|
||||
.meteor/meteorite
|
||||
public/components
|
||||
nohup.out
|
||||
nohup.out
|
||||
dump
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user