Skip to content

Commit

Permalink
fix(debug): populate db with new role permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Feb 19, 2019
1 parent a338f3a commit 2bc5ca6
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/controllers/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,9 @@ debugController.populatedatabase = function (req, res) {
async.series(
[
function (done) {
groupSchema.remove({}, done)
},
function (done) {
tagSchema.remove({}, done)
},
function (done) {
ticketSchema.remove({}, done)
},
function (done) {
var roles = global.roles
var userRole = _.find(roles, { normalized: 'user' })

users = []
for (var i = 0; i < 11; i++) {
var random = Math.floor(Math.random() * (10000 - 1 + 1)) + 1
Expand All @@ -336,14 +330,23 @@ debugController.populatedatabase = function (req, res) {
email: first + '.' + last + random + '@' + chance.domain(),
title: chance.profession(),
password: 'password',
role: 'user'
role: userRole._id
}

users.push(user)
}

userSchema.collection.insert(users, done)
},
function (done) {
groupSchema.remove({}, done)
},
function (done) {
tagSchema.remove({}, done)
},
function (done) {
ticketSchema.remove({}, done)
},
function (done) {
var groups = []
for (var i = 0; i < 11; i++) {
Expand Down

0 comments on commit 2bc5ca6

Please sign in to comment.