added login / logout functionality and authorization rules via bouncer

This commit is contained in:
Sockenklaus
2021-10-17 17:11:21 +02:00
parent 43ee300bd2
commit 4b222c9921
14 changed files with 665 additions and 18 deletions

View File

@@ -0,0 +1,23 @@
import Hash from '@ioc:Adonis/Core/Hash'
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
import User from 'App/Models/User'
export default class Users extends BaseSchema {
protected tableName = 'users'
public async up () {
this.schema.alterTable(this.tableName, (table) => {
table.boolean('is_active').defaultTo(false)
table.string('role')
.defaultTo('employee')
.notNullable()
})
}
public async down () {
this.schema.alterTable(this.tableName, (table) => {
table.dropColumn('is_active')
table.dropColumn('role')
})
}
}