<commit_before>var methodDisabler = require('../../public/methodDisabler.js')
var relationMethodPrefixes = [
  'login',
  'logout'
]

module.exports = function (app) {
  var User = app.models.client
  var Role = app.models.Role
  var RoleMapping = app.models.RoleMapping

  var users = [{
      id: 98989878,
      username: 'MrWooJ',
      email: '<EMAIL>',
      password: '<PASSWORD>',
      time: 1234567891,
      companyName: "Flieral",
      registrationCountry: "US",
      registrationIPAddress: "0.0.0.0",
      emailVerified: true
    },
    {
      id: 98989857,
      username: 'Mohammad4x',
      email: '<EMAIL>',
      password: '<PASSWORD>',
      time: 1234567891,
      companyName: "Flieral",
      registrationCountry: "US",
      registrationIPAddress: "0.0.0.0",
      emailVerified: true
    },
    {
      id: 98989873,
      username: 'Support',
      email: '<EMAIL>',
      password: '<PASSWORD>',
      time: 1234567891,
      companyName: "Flieral",
      registrationCountry: "US",
      registrationIPAddress: "0.0.0.0",
      emailVerified: true
    }
  ]

  User.replaceOrCreate(users, null, function (err, users) {
    if (err)
      throw err

    var role1 = {
      name: 'founder'
    }
    Role.create(role1, function (err, role) {
      if (err)
        throw err
      role.principals.create({
        principalType: RoleMapping.USER,
        principalId: users[0].id
      }, function (err, principal) {
        if (err)
          throw err
      })
      role.principals.create({
        principalType: RoleMapping.USER,
        principalId: users[1].id
      }, function (err, principal) {
        if (err)
          throw err
      })
    })

    var role2 = {
      name: 'admin'
    }
    Role.create(role2, function (err, role) {
      if (err)
        throw err
      role.principals.create({
        principalType: RoleMapping.USER,
        principalId: users[2].id
      }, function (err, principal) {
        if (err)
          throw err
      })
    })
  })

}<commit_msg>Fix Admin and Founder User Create<commit_after>module.exports = function (app) {
  var mongoDs = app.dataSources.mongoDs

  var User = app.models.client
  var Role = app.models.Role
  var RoleMapping = app.models.RoleMapping

  var users = [{
      username: 'MrWooJ',
      email: '<EMAIL>',
      password: '<PASSWORD>',
      time: 1234567891,
      companyName: "Flieral",
      registrationCountry: "US",
      registrationIPAddress: "0.0.0.0",
      emailVerified: true
    },
    {
      username: 'Mohammad4x',
      email: '<EMAIL>',
      password: '<PASSWORD>',
      time: 1234567891,
      companyName: "Flieral",
      registrationCountry: "US",
      registrationIPAddress: "0.0.0.0",
      emailVerified: true
    },
    {
      username: 'Support',
      email: '<EMAIL>',
      password: '<PASSWORD>',
      time: 1234567891,
      companyName: "Flieral",
      registrationCountry: "US",
      registrationIPAddress: "0.0.0.0",
      emailVerified: true
    }
  ]

  function createRoles(users) {
    var role1 = {
      name: 'founder'
    }

    Role.create(role1, function (err, role) {
      if (err)
        throw err
      role.principals.create({
        principalType: RoleMapping.USER,
        principalId: users[0].id
      }, function (err, principal) {
        if (err)
          throw err
      })
      role.principals.create({
        principalType: RoleMapping.USER,
        principalId: users[1].id
      }, function (err, principal) {
        if (err)
          throw err
      })
    })

    var role2 = {
      name: 'admin'
    }
    Role.create(role2, function (err, role) {
      if (err)
        throw err
      role.principals.create({
        principalType: RoleMapping.USER,
        principalId: users[2].id
      }, function (err, principal) {
        if (err)
          throw err
      })
    })
  }

  User.create(users, function (err, users) {
    if (err) {
      User.find({
        where: {
          'companyName': 'Flieral'
        }
      }, function (err, users) {
        if (err)
          throw err
        createRoles(users)
      })
    } else
      createRoles(users)
  })

}
{'fraction_non_alphanumeric': 0.12968299711815562, 'fraction_numerical': 0.029779058597502402, 'mean_word_length': 1.9771265189421015, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '741361', 'n_tokens_mistral': 1401, 'n_tokens_neox': 1348, 'n_words': 296}