14 changed files with 0 additions and 1105 deletions
@ -1,82 +0,0 @@ |
|||||||
<?php |
|
||||||
/** |
|
||||||
* CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make |
|
||||||
* easy some essential jobs such as login, permissions and access operations. |
|
||||||
* Despite ease of use, it has also very advanced features like grouping, |
|
||||||
* access management, public access etc.. |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* @author Emre Akay |
|
||||||
* @author Raphael "REJack" Jackstadt |
|
||||||
* @copyright 2014-2019 Emre Akay |
|
||||||
* @license https://opensource.org/licenses/MIT MIT License |
|
||||||
* @link https://github.com/emreakay/CodeIgniter-Aauth |
|
||||||
*/ |
|
||||||
|
|
||||||
namespace App\Database\Migrations; |
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration; |
|
||||||
use Config\Aauth as AauthConfig; |
|
||||||
|
|
||||||
/** |
|
||||||
* Create CI session table |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* @codeCoverageIgnore |
|
||||||
*/ |
|
||||||
class Migration_create_user_sessions_table extends Migration |
|
||||||
{ |
|
||||||
/** |
|
||||||
* Create Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function up() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
|
|
||||||
$this->forge->addField([ |
|
||||||
'id' => [ |
|
||||||
'type' => 'VARCHAR', |
|
||||||
'constraint' => 128, |
|
||||||
'null' => false, |
|
||||||
], |
|
||||||
'ip_address' => [ |
|
||||||
'type' => 'VARCHAR', |
|
||||||
'constraint' => 45, |
|
||||||
'null' => false, |
|
||||||
], |
|
||||||
'timestamp' => [ |
|
||||||
'type' => 'INT', |
|
||||||
'constraint' => 10, |
|
||||||
'unsigned' => true, |
|
||||||
'null' => false, |
|
||||||
'default' => 0, |
|
||||||
], |
|
||||||
'data' => [ |
|
||||||
'type' => 'TEXT', |
|
||||||
'null' => false, |
|
||||||
'default' => '', |
|
||||||
], |
|
||||||
]); |
|
||||||
$this->forge->addKey('id', true); |
|
||||||
$this->forge->addKey('timestamp'); |
|
||||||
$this->forge->createTable($config->dbTableUserSessions, true); |
|
||||||
} |
|
||||||
|
|
||||||
//-------------------------------------------------------------------- |
|
||||||
|
|
||||||
/** |
|
||||||
* Drops Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function down() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->dropTable($config->dbTableUserSessions, true); |
|
||||||
} |
|
||||||
} |
|
@ -1,104 +0,0 @@ |
|||||||
<?php |
|
||||||
/** |
|
||||||
* CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make |
|
||||||
* easy some essential jobs such as login, permissions and access operations. |
|
||||||
* Despite ease of use, it has also very advanced features like grouping, |
|
||||||
* access management, public access etc.. |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* @author Emre Akay |
|
||||||
* @author Raphael "REJack" Jackstadt |
|
||||||
* @copyright 2014-2019 Emre Akay |
|
||||||
* @license https://opensource.org/licenses/MIT MIT License |
|
||||||
* @link https://github.com/emreakay/CodeIgniter-Aauth |
|
||||||
*/ |
|
||||||
|
|
||||||
namespace App\Database\Migrations; |
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration; |
|
||||||
use Config\Aauth as AauthConfig; |
|
||||||
|
|
||||||
/** |
|
||||||
* Create users table |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* @codeCoverageIgnore |
|
||||||
*/ |
|
||||||
class Migration_create_users_table extends Migration |
|
||||||
{ |
|
||||||
/** |
|
||||||
* Create Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function up() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
|
|
||||||
$this->forge->addField([ |
|
||||||
'id' => [ |
|
||||||
'type' => 'INT', |
|
||||||
'constraint' => 11, |
|
||||||
'unsigned' => true, |
|
||||||
'auto_increment' => true, |
|
||||||
], |
|
||||||
'email' => [ |
|
||||||
'type' => 'VARCHAR', |
|
||||||
'constraint' => 254, |
|
||||||
], |
|
||||||
'username' => [ |
|
||||||
'type' => 'VARCHAR', |
|
||||||
'constraint' => 150, |
|
||||||
'null' => true, |
|
||||||
], |
|
||||||
'password' => [ |
|
||||||
'type' => 'VARCHAR', |
|
||||||
'constraint' => 255, |
|
||||||
], |
|
||||||
'banned' => [ |
|
||||||
'type' => 'TINYINT', |
|
||||||
'constraint' => 1, |
|
||||||
'null' => true, |
|
||||||
'default' => 0, |
|
||||||
], |
|
||||||
'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', |
|
||||||
'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', |
|
||||||
'last_activity' => [ |
|
||||||
'type' => 'DATETIME', |
|
||||||
'default' => null, |
|
||||||
], |
|
||||||
'last_ip_address' => [ |
|
||||||
'type' => 'VARCHAR', |
|
||||||
'constraint' => 39, |
|
||||||
'default' => '', |
|
||||||
], |
|
||||||
'last_login' => [ |
|
||||||
'type' => 'DATETIME', |
|
||||||
'default' => null, |
|
||||||
], |
|
||||||
'deleted' => [ |
|
||||||
'type' => 'TINYINT', |
|
||||||
'constraint' => 1, |
|
||||||
'default' => 0, |
|
||||||
], |
|
||||||
]); |
|
||||||
$this->forge->addKey('id', true); |
|
||||||
$this->forge->createTable($config->dbTableUsers, true); |
|
||||||
} |
|
||||||
|
|
||||||
//-------------------------------------------------------------------- |
|
||||||
|
|
||||||
/** |
|
||||||
* Drops Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function down() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->dropTable($config->dbTableUsers, true); |
|
||||||
} |
|
||||||
} |
|
@ -1,83 +0,0 @@ |
|||||||
<?php |
|
||||||
/** |
|
||||||
* CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make |
|
||||||
* easy some essential jobs such as login, permissions and access operations. |
|
||||||
* Despite ease of use, it has also very advanced features like grouping, |
|
||||||
* access management, public access etc.. |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* @author Emre Akay |
|
||||||
* @author Raphael "REJack" Jackstadt |
|
||||||
* @copyright 2014-2019 Emre Akay |
|
||||||
* @license https://opensource.org/licenses/MIT MIT License |
|
||||||
* @link https://github.com/emreakay/CodeIgniter-Aauth |
|
||||||
*/ |
|
||||||
|
|
||||||
namespace App\Database\Migrations; |
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration; |
|
||||||
use Config\Aauth as AauthConfig; |
|
||||||
|
|
||||||
/** |
|
||||||
* Create user variables table |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* @codeCoverageIgnore |
|
||||||
*/ |
|
||||||
class Migration_create_user_variables extends Migration |
|
||||||
{ |
|
||||||
/** |
|
||||||
* Create Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function up() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->addField([ |
|
||||||
'id' => [ |
|
||||||
'type' => 'INT', |
|
||||||
'constraint' => 11, |
|
||||||
'unsigned' => true, |
|
||||||
'auto_increment' => true, |
|
||||||
], |
|
||||||
'user_id' => [ |
|
||||||
'type' => 'INT', |
|
||||||
'constraint' => 11, |
|
||||||
'unsigned' => true, |
|
||||||
], |
|
||||||
'data_key' => [ |
|
||||||
'type' => 'VARCHAR', |
|
||||||
'constraint' => 100, |
|
||||||
], |
|
||||||
'data_value' => [ |
|
||||||
'type' => 'TEXT', |
|
||||||
], |
|
||||||
'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', |
|
||||||
'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', |
|
||||||
'system' => [ |
|
||||||
'type' => 'TINYINT', |
|
||||||
'constraint' => 1, |
|
||||||
'default' => 0, |
|
||||||
], |
|
||||||
]); |
|
||||||
$this->forge->addKey('id', true); |
|
||||||
$this->forge->createTable($config->dbTableUserVariables, true); |
|
||||||
} |
|
||||||
|
|
||||||
//-------------------------------------------------------------------- |
|
||||||
|
|
||||||
/** |
|
||||||
* Drops Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function down() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->dropTable($config->dbTableUserVariables, true); |
|
||||||
} |
|
||||||
} |
|
@ -1,79 +0,0 @@ |
|||||||
<?php |
|
||||||
/** |
|
||||||
* CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make |
|
||||||
* easy some essential jobs such as login, permissions and access operations. |
|
||||||
* Despite ease of use, it has also very advanced features like grouping, |
|
||||||
* access management, public access etc.. |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* @author Emre Akay |
|
||||||
* @author Raphael "REJack" Jackstadt |
|
||||||
* @copyright 2014-2019 Emre Akay |
|
||||||
* @license https://opensource.org/licenses/MIT MIT License |
|
||||||
* @link https://github.com/emreakay/CodeIgniter-Aauth |
|
||||||
*/ |
|
||||||
|
|
||||||
namespace App\Database\Migrations; |
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration; |
|
||||||
use Config\Aauth as AauthConfig; |
|
||||||
|
|
||||||
/** |
|
||||||
* Create login attempts table |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* @codeCoverageIgnore |
|
||||||
*/ |
|
||||||
class Migration_create_login_attempts extends Migration |
|
||||||
{ |
|
||||||
/** |
|
||||||
* Create Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function up() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->addField([ |
|
||||||
'id' => [ |
|
||||||
'type' => 'INT', |
|
||||||
'constraint' => 11, |
|
||||||
'unsigned' => true, |
|
||||||
'auto_increment' => true, |
|
||||||
], |
|
||||||
'ip_address' => [ |
|
||||||
'type' => 'VARCHAR', |
|
||||||
'constraint' => 39, |
|
||||||
'default' => 0, |
|
||||||
], |
|
||||||
'user_agent' => [ |
|
||||||
'type' => 'TINYTEXT', |
|
||||||
], |
|
||||||
'count' => [ |
|
||||||
'type' => 'TINYINT', |
|
||||||
'constraint' => 2, |
|
||||||
'default' => 0, |
|
||||||
], |
|
||||||
'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', |
|
||||||
'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', |
|
||||||
]); |
|
||||||
$this->forge->addKey('id', true); |
|
||||||
$this->forge->createTable($config->dbTableLoginAttempts, true); |
|
||||||
} |
|
||||||
|
|
||||||
//-------------------------------------------------------------------- |
|
||||||
|
|
||||||
/** |
|
||||||
* Drops Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function down() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->dropTable($config->dbTableLoginAttempts, true); |
|
||||||
} |
|
||||||
} |
|
@ -1,80 +0,0 @@ |
|||||||
<?php |
|
||||||
/** |
|
||||||
* CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make |
|
||||||
* easy some essential jobs such as login, permissions and access operations. |
|
||||||
* Despite ease of use, it has also very advanced features like grouping, |
|
||||||
* access management, public access etc.. |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* @author Emre Akay |
|
||||||
* @author Raphael "REJack" Jackstadt |
|
||||||
* @copyright 2014-2019 Emre Akay |
|
||||||
* @license https://opensource.org/licenses/MIT MIT License |
|
||||||
* @link https://github.com/emreakay/CodeIgniter-Aauth |
|
||||||
*/ |
|
||||||
|
|
||||||
namespace App\Database\Migrations; |
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration; |
|
||||||
use Config\Aauth as AauthConfig; |
|
||||||
|
|
||||||
/** |
|
||||||
* Create login tokens table |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* @codeCoverageIgnore |
|
||||||
*/ |
|
||||||
class Migration_create_login_tokens extends Migration |
|
||||||
{ |
|
||||||
/** |
|
||||||
* Create Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function up() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->addField([ |
|
||||||
'id' => [ |
|
||||||
'type' => 'INT', |
|
||||||
'constraint' => 11, |
|
||||||
'unsigned' => true, |
|
||||||
'auto_increment' => true, |
|
||||||
], |
|
||||||
'user_id' => [ |
|
||||||
'type' => 'INT', |
|
||||||
'constraint' => 11, |
|
||||||
'default' => 0, |
|
||||||
], |
|
||||||
'random_hash' => [ |
|
||||||
'type' => 'VARCHAR', |
|
||||||
'constraint' => 255, |
|
||||||
], |
|
||||||
'selector_hash' => [ |
|
||||||
'type' => 'VARCHAR', |
|
||||||
'constraint' => 255, |
|
||||||
], |
|
||||||
'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', |
|
||||||
'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', |
|
||||||
'expires_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', |
|
||||||
]); |
|
||||||
$this->forge->addKey('id', true); |
|
||||||
$this->forge->createTable($config->dbTableLoginTokens, true); |
|
||||||
} |
|
||||||
|
|
||||||
//-------------------------------------------------------------------- |
|
||||||
|
|
||||||
/** |
|
||||||
* Drops Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function down() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->dropTable($config->dbTableLoginTokens, true); |
|
||||||
} |
|
||||||
} |
|
@ -1,78 +0,0 @@ |
|||||||
<?php |
|
||||||
/** |
|
||||||
* CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make |
|
||||||
* easy some essential jobs such as login, permissions and access operations. |
|
||||||
* Despite ease of use, it has also very advanced features like grouping, |
|
||||||
* access management, public access etc.. |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* @author Emre Akay |
|
||||||
* @author Raphael "REJack" Jackstadt |
|
||||||
* @copyright 2014-2019 Emre Akay |
|
||||||
* @license https://opensource.org/licenses/MIT MIT License |
|
||||||
* @link https://github.com/emreakay/CodeIgniter-Aauth |
|
||||||
*/ |
|
||||||
|
|
||||||
namespace App\Database\Migrations; |
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration; |
|
||||||
use Config\Aauth as AauthConfig; |
|
||||||
|
|
||||||
/** |
|
||||||
* Create group tables |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* @codeCoverageIgnore |
|
||||||
*/ |
|
||||||
class Migration_create_groups extends Migration |
|
||||||
{ |
|
||||||
/** |
|
||||||
* Create Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function up() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->addField([ |
|
||||||
'id' => [ |
|
||||||
'type' => 'INT', |
|
||||||
'constraint' => 11, |
|
||||||
'unsigned' => true, |
|
||||||
'auto_increment' => true, |
|
||||||
], |
|
||||||
'name' => [ |
|
||||||
'type' => 'VARCHAR', |
|
||||||
'constraint' => 100, |
|
||||||
], |
|
||||||
'definition' => [ |
|
||||||
'type' => 'TEXT', |
|
||||||
], |
|
||||||
'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', |
|
||||||
'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', |
|
||||||
'deleted' => [ |
|
||||||
'type' => 'TINYINT', |
|
||||||
'constraint' => 1, |
|
||||||
'default' => 0, |
|
||||||
], |
|
||||||
]); |
|
||||||
$this->forge->addKey('id', true); |
|
||||||
$this->forge->createTable($config->dbTableGroups, true); |
|
||||||
} |
|
||||||
|
|
||||||
//-------------------------------------------------------------------- |
|
||||||
|
|
||||||
/** |
|
||||||
* Drops Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function down() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->dropTable($config->dbTableGroups, true); |
|
||||||
} |
|
||||||
} |
|
@ -1,83 +0,0 @@ |
|||||||
<?php |
|
||||||
/** |
|
||||||
* CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make |
|
||||||
* easy some essential jobs such as login, permissions and access operations. |
|
||||||
* Despite ease of use, it has also very advanced features like grouping, |
|
||||||
* access management, public access etc.. |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* @author Emre Akay |
|
||||||
* @author Raphael "REJack" Jackstadt |
|
||||||
* @copyright 2014-2019 Emre Akay |
|
||||||
* @license https://opensource.org/licenses/MIT MIT License |
|
||||||
* @link https://github.com/emreakay/CodeIgniter-Aauth |
|
||||||
*/ |
|
||||||
|
|
||||||
namespace App\Database\Migrations; |
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration; |
|
||||||
use Config\Aauth as AauthConfig; |
|
||||||
|
|
||||||
/** |
|
||||||
* Create group variables table |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* @codeCoverageIgnore |
|
||||||
*/ |
|
||||||
class Migration_create_group_variables extends Migration |
|
||||||
{ |
|
||||||
/** |
|
||||||
* Create Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function up() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->addField([ |
|
||||||
'id' => [ |
|
||||||
'type' => 'INT', |
|
||||||
'constraint' => 11, |
|
||||||
'unsigned' => true, |
|
||||||
'auto_increment' => true, |
|
||||||
], |
|
||||||
'group_id' => [ |
|
||||||
'type' => 'INT', |
|
||||||
'constraint' => 11, |
|
||||||
'unsigned' => true, |
|
||||||
], |
|
||||||
'data_key' => [ |
|
||||||
'type' => 'VARCHAR', |
|
||||||
'constraint' => 100, |
|
||||||
], |
|
||||||
'data_value' => [ |
|
||||||
'type' => 'TEXT', |
|
||||||
], |
|
||||||
'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', |
|
||||||
'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', |
|
||||||
'system' => [ |
|
||||||
'type' => 'TINYINT', |
|
||||||
'constraint' => 1, |
|
||||||
'default' => 0, |
|
||||||
], |
|
||||||
]); |
|
||||||
$this->forge->addKey('id', true); |
|
||||||
$this->forge->createTable($config->dbTableGroupVariables, true); |
|
||||||
} |
|
||||||
|
|
||||||
//-------------------------------------------------------------------- |
|
||||||
|
|
||||||
/** |
|
||||||
* Drops Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function down() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->dropTable($config->dbTableGroupVariables, true); |
|
||||||
} |
|
||||||
} |
|
@ -1,68 +0,0 @@ |
|||||||
<?php |
|
||||||
/** |
|
||||||
* CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make |
|
||||||
* easy some essential jobs such as login, permissions and access operations. |
|
||||||
* Despite ease of use, it has also very advanced features like grouping, |
|
||||||
* access management, public access etc.. |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* @author Emre Akay |
|
||||||
* @author Raphael "REJack" Jackstadt |
|
||||||
* @copyright 2014-2019 Emre Akay |
|
||||||
* @license https://opensource.org/licenses/MIT MIT License |
|
||||||
* @link https://github.com/emreakay/CodeIgniter-Aauth |
|
||||||
*/ |
|
||||||
|
|
||||||
namespace App\Database\Migrations; |
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration; |
|
||||||
use Config\Aauth as AauthConfig; |
|
||||||
|
|
||||||
/** |
|
||||||
* Create group to user table |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* @codeCoverageIgnore |
|
||||||
*/ |
|
||||||
class Migration_create_group_to_user extends Migration |
|
||||||
{ |
|
||||||
/** |
|
||||||
* Create Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function up() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->addField([ |
|
||||||
'group_id' => [ |
|
||||||
'type' => 'INT', |
|
||||||
'constraint' => 11, |
|
||||||
'unsigned' => true, |
|
||||||
], |
|
||||||
'user_id' => [ |
|
||||||
'type' => 'INT', |
|
||||||
'constraint' => 11, |
|
||||||
'unsigned' => true, |
|
||||||
], |
|
||||||
]); |
|
||||||
$this->forge->addKey(['group_id', 'user_id'], true); |
|
||||||
$this->forge->createTable($config->dbTableGroupToUser, true); |
|
||||||
} |
|
||||||
|
|
||||||
//-------------------------------------------------------------------- |
|
||||||
|
|
||||||
/** |
|
||||||
* Drops Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function down() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->dropTable($config->dbTableGroupToUser, true); |
|
||||||
} |
|
||||||
} |
|
@ -1,68 +0,0 @@ |
|||||||
<?php |
|
||||||
/** |
|
||||||
* CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make |
|
||||||
* easy some essential jobs such as login, permissions and access operations. |
|
||||||
* Despite ease of use, it has also very advanced features like grouping, |
|
||||||
* access management, public access etc.. |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* @author Emre Akay |
|
||||||
* @author Raphael "REJack" Jackstadt |
|
||||||
* @copyright 2014-2019 Emre Akay |
|
||||||
* @license https://opensource.org/licenses/MIT MIT License |
|
||||||
* @link https://github.com/emreakay/CodeIgniter-Aauth |
|
||||||
*/ |
|
||||||
|
|
||||||
namespace App\Database\Migrations; |
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration; |
|
||||||
use Config\Aauth as AauthConfig; |
|
||||||
|
|
||||||
/** |
|
||||||
* Create group to group table |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* @codeCoverageIgnore |
|
||||||
*/ |
|
||||||
class Migration_create_group_to_group extends Migration |
|
||||||
{ |
|
||||||
/** |
|
||||||
* Create Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function up() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->addField([ |
|
||||||
'group_id' => [ |
|
||||||
'type' => 'INT', |
|
||||||
'constraint' => 11, |
|
||||||
'unsigned' => true, |
|
||||||
], |
|
||||||
'subgroup_id' => [ |
|
||||||
'type' => 'INT', |
|
||||||
'constraint' => 11, |
|
||||||
'unsigned' => true, |
|
||||||
], |
|
||||||
]); |
|
||||||
$this->forge->addKey(['group_id', 'subgroup_id'], true); |
|
||||||
$this->forge->createTable($config->dbTableGroupToGroup, true); |
|
||||||
} |
|
||||||
|
|
||||||
//-------------------------------------------------------------------- |
|
||||||
|
|
||||||
/** |
|
||||||
* Drops Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function down() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->dropTable($config->dbTableGroupToGroup, true); |
|
||||||
} |
|
||||||
} |
|
@ -1,78 +0,0 @@ |
|||||||
<?php |
|
||||||
/** |
|
||||||
* CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make |
|
||||||
* easy some essential jobs such as login, permissions and access operations. |
|
||||||
* Despite ease of use, it has also very advanced features like grouping, |
|
||||||
* access management, public access etc.. |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* @author Emre Akay |
|
||||||
* @author Raphael "REJack" Jackstadt |
|
||||||
* @copyright 2014-2019 Emre Akay |
|
||||||
* @license https://opensource.org/licenses/MIT MIT License |
|
||||||
* @link https://github.com/emreakay/CodeIgniter-Aauth |
|
||||||
*/ |
|
||||||
|
|
||||||
namespace App\Database\Migrations; |
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration; |
|
||||||
use Config\Aauth as AauthConfig; |
|
||||||
|
|
||||||
/** |
|
||||||
* Create perms table |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* @codeCoverageIgnore |
|
||||||
*/ |
|
||||||
class Migration_create_perms extends Migration |
|
||||||
{ |
|
||||||
/** |
|
||||||
* Create Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function up() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->addField([ |
|
||||||
'id' => [ |
|
||||||
'type' => 'INT', |
|
||||||
'constraint' => 11, |
|
||||||
'unsigned' => true, |
|
||||||
'auto_increment' => true, |
|
||||||
], |
|
||||||
'name' => [ |
|
||||||
'type' => 'VARCHAR', |
|
||||||
'constraint' => 100, |
|
||||||
], |
|
||||||
'definition' => [ |
|
||||||
'type' => 'TEXT', |
|
||||||
], |
|
||||||
'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', |
|
||||||
'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', |
|
||||||
'deleted' => [ |
|
||||||
'type' => 'TINYINT', |
|
||||||
'constraint' => 1, |
|
||||||
'default' => 0, |
|
||||||
], |
|
||||||
]); |
|
||||||
$this->forge->addKey('id', true); |
|
||||||
$this->forge->createTable($config->dbTablePerms, true); |
|
||||||
} |
|
||||||
|
|
||||||
//-------------------------------------------------------------------- |
|
||||||
|
|
||||||
/** |
|
||||||
* Drops Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function down() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->dropTable($config->dbTablePerms, true); |
|
||||||
} |
|
||||||
} |
|
@ -1,73 +0,0 @@ |
|||||||
<?php |
|
||||||
/** |
|
||||||
* CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make |
|
||||||
* easy some essential jobs such as login, permissions and access operations. |
|
||||||
* Despite ease of use, it has also very advanced features like grouping, |
|
||||||
* access management, public access etc.. |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* @author Emre Akay |
|
||||||
* @author Raphael "REJack" Jackstadt |
|
||||||
* @copyright 2014-2019 Emre Akay |
|
||||||
* @license https://opensource.org/licenses/MIT MIT License |
|
||||||
* @link https://github.com/emreakay/CodeIgniter-Aauth |
|
||||||
*/ |
|
||||||
|
|
||||||
namespace App\Database\Migrations; |
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration; |
|
||||||
use Config\Aauth as AauthConfig; |
|
||||||
|
|
||||||
/** |
|
||||||
* Create perm to user table |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* @codeCoverageIgnore |
|
||||||
*/ |
|
||||||
class Migration_create_perm_to_user extends Migration |
|
||||||
{ |
|
||||||
/** |
|
||||||
* Create Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function up() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->addField([ |
|
||||||
'perm_id' => [ |
|
||||||
'type' => 'INT', |
|
||||||
'constraint' => 11, |
|
||||||
'unsigned' => true, |
|
||||||
], |
|
||||||
'user_id' => [ |
|
||||||
'type' => 'INT', |
|
||||||
'constraint' => 11, |
|
||||||
'unsigned' => true, |
|
||||||
], |
|
||||||
'state' => [ |
|
||||||
'type' => 'TINYINT', |
|
||||||
'constraint' => 1, |
|
||||||
'default' => 1, |
|
||||||
], |
|
||||||
]); |
|
||||||
$this->forge->addKey(['perm_id', 'user_id'], true); |
|
||||||
$this->forge->createTable($config->dbTablePermToUser, true); |
|
||||||
} |
|
||||||
|
|
||||||
//-------------------------------------------------------------------- |
|
||||||
|
|
||||||
/** |
|
||||||
* Drops Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function down() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->dropTable($config->dbTablePermToUser, true); |
|
||||||
} |
|
||||||
} |
|
@ -1,73 +0,0 @@ |
|||||||
<?php |
|
||||||
/** |
|
||||||
* CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make |
|
||||||
* easy some essential jobs such as login, permissions and access operations. |
|
||||||
* Despite ease of use, it has also very advanced features like grouping, |
|
||||||
* access management, public access etc.. |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* @author Emre Akay |
|
||||||
* @author Raphael "REJack" Jackstadt |
|
||||||
* @copyright 2014-2019 Emre Akay |
|
||||||
* @license https://opensource.org/licenses/MIT MIT License |
|
||||||
* @link https://github.com/emreakay/CodeIgniter-Aauth |
|
||||||
*/ |
|
||||||
|
|
||||||
namespace App\Database\Migrations; |
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration; |
|
||||||
use Config\Aauth as AauthConfig; |
|
||||||
|
|
||||||
/** |
|
||||||
* Create perm to group table |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* @codeCoverageIgnore |
|
||||||
*/ |
|
||||||
class Migration_create_perm_to_group extends Migration |
|
||||||
{ |
|
||||||
/** |
|
||||||
* Create Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function up() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->addField([ |
|
||||||
'perm_id' => [ |
|
||||||
'type' => 'INT', |
|
||||||
'constraint' => 11, |
|
||||||
'unsigned' => true, |
|
||||||
], |
|
||||||
'group_id' => [ |
|
||||||
'type' => 'INT', |
|
||||||
'constraint' => 11, |
|
||||||
'unsigned' => true, |
|
||||||
], |
|
||||||
'state' => [ |
|
||||||
'type' => 'TINYINT', |
|
||||||
'constraint' => 1, |
|
||||||
'default' => 1, |
|
||||||
], |
|
||||||
]); |
|
||||||
$this->forge->addKey(['perm_id', 'user_id'], true); |
|
||||||
$this->forge->createTable($config->dbTablePermToGroup, true); |
|
||||||
} |
|
||||||
|
|
||||||
//-------------------------------------------------------------------- |
|
||||||
|
|
||||||
/** |
|
||||||
* Drops Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function down() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->forge->dropTable($config->dbTablePermToGroup, true); |
|
||||||
} |
|
||||||
} |
|
@ -1,70 +0,0 @@ |
|||||||
<?php |
|
||||||
/** |
|
||||||
* CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make |
|
||||||
* easy some essential jobs such as login, permissions and access operations. |
|
||||||
* Despite ease of use, it has also very advanced features like grouping, |
|
||||||
* access management, public access etc.. |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* @author Emre Akay |
|
||||||
* @author Raphael "REJack" Jackstadt |
|
||||||
* @copyright 2014-2019 Emre Akay |
|
||||||
* @license https://opensource.org/licenses/MIT MIT License |
|
||||||
* @link https://github.com/emreakay/CodeIgniter-Aauth |
|
||||||
*/ |
|
||||||
|
|
||||||
namespace App\Database\Migrations; |
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration; |
|
||||||
use Config\Aauth as AauthConfig; |
|
||||||
|
|
||||||
/** |
|
||||||
* Create default groups |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* @codeCoverageIgnore |
|
||||||
*/ |
|
||||||
class Migration_create_default_groups extends Migration |
|
||||||
{ |
|
||||||
/** |
|
||||||
* Create Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function up() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$data = [ |
|
||||||
[ |
|
||||||
'name' => $config->groupAdmin, |
|
||||||
'definition' => 'Administators', |
|
||||||
], |
|
||||||
[ |
|
||||||
'name' => $config->groupDefault, |
|
||||||
'definition' => 'Users', |
|
||||||
], |
|
||||||
[ |
|
||||||
'name' => $config->groupPublic, |
|
||||||
'definition' => 'Guests', |
|
||||||
], |
|
||||||
]; |
|
||||||
|
|
||||||
$this->db->table($config->dbTableGroups)->insertBatch($data); |
|
||||||
} |
|
||||||
|
|
||||||
//-------------------------------------------------------------------- |
|
||||||
|
|
||||||
/** |
|
||||||
* Drops Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function down() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->db->table($config->dbTableGroups)->truncate(); |
|
||||||
} |
|
||||||
} |
|
@ -1,86 +0,0 @@ |
|||||||
<?php |
|
||||||
/** |
|
||||||
* CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make |
|
||||||
* easy some essential jobs such as login, permissions and access operations. |
|
||||||
* Despite ease of use, it has also very advanced features like grouping, |
|
||||||
* access management, public access etc.. |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* @author Emre Akay |
|
||||||
* @author Raphael "REJack" Jackstadt |
|
||||||
* @copyright 2014-2019 Emre Akay |
|
||||||
* @license https://opensource.org/licenses/MIT MIT License |
|
||||||
* @link https://github.com/emreakay/CodeIgniter-Aauth |
|
||||||
*/ |
|
||||||
|
|
||||||
namespace App\Database\Migrations; |
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration; |
|
||||||
use Config\Aauth as AauthConfig; |
|
||||||
|
|
||||||
/** |
|
||||||
* Create default admin |
|
||||||
* |
|
||||||
* @package CodeIgniter-Aauth |
|
||||||
* |
|
||||||
* @codeCoverageIgnore |
|
||||||
*/ |
|
||||||
class Migration_create_default_users extends Migration |
|
||||||
{ |
|
||||||
/** |
|
||||||
* Create Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function up() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$data = [ |
|
||||||
[ |
|
||||||
'username' => 'admin', |
|
||||||
'email' => 'admin@example.com', |
|
||||||
'password' => password_hash('password123456', $config->passwordHashAlgo, $config->passwordHashOptions), |
|
||||||
], |
|
||||||
[ |
|
||||||
'username' => 'user', |
|
||||||
'email' => 'user@example.com', |
|
||||||
'password' => password_hash('password123456', $config->passwordHashAlgo, $config->passwordHashOptions), |
|
||||||
], |
|
||||||
]; |
|
||||||
|
|
||||||
$this->db->table($config->dbTableUsers)->insertBatch($data); |
|
||||||
|
|
||||||
$data = [ |
|
||||||
[ |
|
||||||
'group_id' => 1, |
|
||||||
'user_id' => 1, |
|
||||||
], |
|
||||||
[ |
|
||||||
'group_id' => 2, |
|
||||||
'user_id' => 1, |
|
||||||
], |
|
||||||
[ |
|
||||||
'group_id' => 2, |
|
||||||
'user_id' => 2, |
|
||||||
], |
|
||||||
]; |
|
||||||
|
|
||||||
$this->db->table($config->dbTableGroupToUser)->insertBatch($data); |
|
||||||
} |
|
||||||
|
|
||||||
//-------------------------------------------------------------------- |
|
||||||
|
|
||||||
/** |
|
||||||
* Drops Table |
|
||||||
* |
|
||||||
* @return void |
|
||||||
*/ |
|
||||||
public function down() |
|
||||||
{ |
|
||||||
$config = new AauthConfig(); |
|
||||||
$this->db->table($config->dbTableUsers)->truncate(); |
|
||||||
$this->db->table($config->dbTableGroupToUser)->truncate(); |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue