From c60f2212fd326c323dc2d145ba64080612b655d3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 27 Sep 2016 22:41:38 +0200 Subject: Server: migration script that add admin role to root user --- server/initializers/migrations/0015-admin-role.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 server/initializers/migrations/0015-admin-role.js (limited to 'server/initializers/migrations/0015-admin-role.js') diff --git a/server/initializers/migrations/0015-admin-role.js b/server/initializers/migrations/0015-admin-role.js new file mode 100644 index 000000000..af06dca9e --- /dev/null +++ b/server/initializers/migrations/0015-admin-role.js @@ -0,0 +1,16 @@ +/* + Set the admin role to the root user. +*/ + +const constants = require('../constants') +const mongoose = require('mongoose') + +const User = mongoose.model('User') + +exports.up = function (callback) { + User.update({ username: 'root' }, { role: constants.USER_ROLES.ADMIN }, callback) +} + +exports.down = function (callback) { + throw new Error('Not implemented.') +} -- cgit v1.2.3