Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
};
// EXPL: We use the actual endpoint to take advantage of policies. Specifically in this case we need to
// take advantage of duplicate fields so that roleName and roleRank are populated.
// (see: https://github.com/JKHeadley/rest-hapi#policies-vs-middleware)
let request = {
method: 'POST',
url: '/user',
params: {},
query: {},
payload: user,
credentials: {scope: ['root', USER_ROLES.SUPER_ADMIN]},
headers: {authorization: 'Bearer'}
}
let injectOptions = RestHapi.testHelper.mockInjection(request)
return server.inject(injectOptions)
})
.then(function(result) {
};
// EXPL: We use the actual endpoint to take advantage of policies. Specifically in this case we need to
// take advantage of duplicate fields so that roleName and roleRank are populated.
// (see: https://github.com/JKHeadley/rest-hapi#policies-vs-middleware)
let request = {
method: 'POST',
url: '/user',
params: {},
query: {},
payload: user,
credentials: {scope: ['root', USER_ROLES.SUPER_ADMIN]},
headers: {authorization: 'Bearer'}
}
let injectOptions = RestHapi.testHelper.mockInjection(request)
return server.inject(injectOptions)
})
.then(function(result) {
role: roles[2]._id,
isActive: true
}
]
request = {
method: 'POST',
url: '/user',
params: {},
query: {},
payload: users,
credentials: {scope: ['root', USER_ROLES.SUPER_ADMIN]},
headers: {authorization: 'Bearer'}
}
injectOptions = RestHapi.testHelper.mockInjection(request)
return server.inject(injectOptions)
})
.then(function (result) {
role: roles[2]._id,
isActive: true
}
]
request = {
method: 'POST',
url: '/user',
params: {},
query: {},
payload: users,
credentials: { scope: ['root', USER_ROLES.SUPER_ADMIN] },
headers: { authorization: 'Bearer' }
}
injectOptions = RestHapi.testHelper.mockInjection(request)
let result = await server.inject(injectOptions)
users = result.result
Log.log('seeding visitors')
promises = []
let addVisitor = function(visitor) {
let rand = Math.random()
let browser = 'Other'
if (rand > 0 && rand <= 0.4) {
browser = 'Chrome'
} else if (rand > 0.4 && rand <= 0.7) {
browser = 'Firefox'