fix: force user ids during setup
This commit is contained in:
parent
c7d6473401
commit
f9e10d5107
@ -212,12 +212,14 @@ module.exports = () => {
|
|||||||
|
|
||||||
WIKI.logger.info('Creating default groups...')
|
WIKI.logger.info('Creating default groups...')
|
||||||
const adminGroup = await WIKI.models.groups.query().insert({
|
const adminGroup = await WIKI.models.groups.query().insert({
|
||||||
|
id: 1,
|
||||||
name: 'Administrators',
|
name: 'Administrators',
|
||||||
permissions: JSON.stringify(['manage:system']),
|
permissions: JSON.stringify(['manage:system']),
|
||||||
pageRules: JSON.stringify([]),
|
pageRules: JSON.stringify([]),
|
||||||
isSystem: true
|
isSystem: true
|
||||||
})
|
})
|
||||||
const guestGroup = await WIKI.models.groups.query().insert({
|
const guestGroup = await WIKI.models.groups.query().insert({
|
||||||
|
id: 2,
|
||||||
name: 'Guests',
|
name: 'Guests',
|
||||||
permissions: JSON.stringify(['read:pages', 'read:assets', 'read:comments']),
|
permissions: JSON.stringify(['read:pages', 'read:assets', 'read:comments']),
|
||||||
pageRules: JSON.stringify([
|
pageRules: JSON.stringify([
|
||||||
@ -254,8 +256,9 @@ module.exports = () => {
|
|||||||
await WIKI.models.users.query().delete().where({
|
await WIKI.models.users.query().delete().where({
|
||||||
providerKey: 'local',
|
providerKey: 'local',
|
||||||
email: req.body.adminEmail
|
email: req.body.adminEmail
|
||||||
})
|
}).orWhere('id', 1)
|
||||||
const adminUser = await WIKI.models.users.query().insert({
|
const adminUser = await WIKI.models.users.query().insert({
|
||||||
|
id: 1,
|
||||||
email: req.body.adminEmail,
|
email: req.body.adminEmail,
|
||||||
provider: 'local',
|
provider: 'local',
|
||||||
password: req.body.adminPassword,
|
password: req.body.adminPassword,
|
||||||
@ -273,8 +276,9 @@ module.exports = () => {
|
|||||||
await WIKI.models.users.query().delete().where({
|
await WIKI.models.users.query().delete().where({
|
||||||
providerKey: 'local',
|
providerKey: 'local',
|
||||||
email: 'guest@example.com'
|
email: 'guest@example.com'
|
||||||
})
|
}).orWhere('id', 2)
|
||||||
const guestUser = await WIKI.models.users.query().insert({
|
const guestUser = await WIKI.models.users.query().insert({
|
||||||
|
id: 2,
|
||||||
provider: 'local',
|
provider: 'local',
|
||||||
email: 'guest@example.com',
|
email: 'guest@example.com',
|
||||||
name: 'Guest',
|
name: 'Guest',
|
||||||
|
Loading…
Reference in New Issue
Block a user