Browse Source

updated Migrations

- changed codestandard to CodeIgniter4 (phpcs)
- added document doc & class doc
- added fuctions docs
v3-dev
REJack 7 years ago
parent
commit
5a05050f0d
  1. 49
      application/Database/Migrations/20181026042034_create_ci_sessions_table.php
  2. 79
      application/Database/Migrations/20181026110732_create_users_table.php
  3. 58
      application/Database/Migrations/20181031062503_create_user_variables.php
  4. 56
      application/Database/Migrations/20181031063113_create_login_attempts.php
  5. 56
      application/Database/Migrations/20181031063642_create_login_tokens.php
  6. 54
      application/Database/Migrations/20181031064211_create_groups.php
  7. 50
      application/Database/Migrations/20181031064431_create_group_to_user.php
  8. 50
      application/Database/Migrations/20181031064550_create_group_to_group.php
  9. 54
      application/Database/Migrations/20181031064714_create_perms.php
  10. 48
      application/Database/Migrations/20181031065111_create_perm_to_user.php
  11. 50
      application/Database/Migrations/20181031065240_create_perm_to_group.php
  12. 40
      application/Database/Migrations/20181031072542_create_default_groups.php
  13. 40
      application/Database/Migrations/20181031072914_create_default_admin.php

49
application/Database/Migrations/20181026042034_create_ci_sessions_table.php

@ -1,35 +1,65 @@
<?php <?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 groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @copyright 2014-2017 Emre Akay
* @copyright 2018 Magefly
* @license https://opensource.org/licenses/MIT MIT License
* @link https://github.com/magefly/CodeIgniter-Aauth
*/
namespace App\Database\Migrations; namespace App\Database\Migrations;
use CodeIgniter\Database\Migration; use CodeIgniter\Database\Migration;
/**
* Create CI session table
*
* @package CodeIgniter-Aauth
*
* @codeCoverageIgnore
*/
class Migration_create_ci_sessions_table extends Migration class Migration_create_ci_sessions_table extends Migration
{ {
/**
* Create Table
*
* @return void
*/
public function up() public function up()
{ {
$this->forge->addField([ $this->forge->addField([
'id' => [ 'id' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 128, 'constraint' => 128,
'null' => false 'null' => false,
], ],
'ip_address' => [ 'ip_address' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 45, 'constraint' => 45,
'null' => false 'null' => false,
], ],
'timestamp' => [ 'timestamp' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 10, 'constraint' => 10,
'unsigned' => true, 'unsigned' => true,
'null' => false, 'null' => false,
'default' => 0 'default' => 0,
], ],
'data' => [ 'data' => [
'type' => 'TEXT', 'type' => 'TEXT',
'null' => false, 'null' => false,
'default' => '' 'default' => '',
], ],
]); ]);
$this->forge->addKey('id', true); $this->forge->addKey('id', true);
@ -39,6 +69,11 @@ class Migration_create_ci_sessions_table extends Migration
//-------------------------------------------------------------------- //--------------------------------------------------------------------
/**
* Drops Table
*
* @return void
*/
public function down() public function down()
{ {
$this->forge->dropTable('ci_sessions', true); $this->forge->dropTable('ci_sessions', true);

79
application/Database/Migrations/20181026110732_create_users_table.php

@ -1,69 +1,104 @@
<?php <?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 groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @copyright 2014-2017 Emre Akay
* @copyright 2018 Magefly
* @license https://opensource.org/licenses/MIT MIT License
* @link https://github.com/magefly/CodeIgniter-Aauth
*/
namespace App\Database\Migrations; namespace App\Database\Migrations;
use CodeIgniter\Database\Migration; use CodeIgniter\Database\Migration;
use Config\Aauth as AauthConfig; use Config\Aauth as AauthConfig;
/**
* Create users table
*
* @package CodeIgniter-Aauth
*
* @codeCoverageIgnore
*/
class Migration_create_users_table extends Migration class Migration_create_users_table extends Migration
{ {
/**
* Create Table
*
* @return void
*/
public function up() public function up()
{ {
$config = new AauthConfig(); $config = new AauthConfig();
$this->forge->addField([ $this->forge->addField([
'id' => [ 'id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => true,
'auto_increment' => TRUE, 'auto_increment' => true,
], ],
'email' => [ 'email' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 254, 'constraint' => 254,
], ],
'username' => [ 'username' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 150, 'constraint' => 150,
'null' => TRUE, 'null' => true,
], ],
'password' => [ 'password' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 60, 'constraint' => 60,
], ],
'banned' => [ 'banned' => [
'type' => 'TINYINT', 'type' => 'TINYINT',
'constraint' => 1, 'constraint' => 1,
'null' => TRUE, 'null' => true,
'default' => 0, 'default' => 0,
], ],
'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
'last_activity' => [ 'last_activity' => [
'type' => 'DATETIME', 'type' => 'DATETIME',
'default' => NULL, 'default' => null,
], ],
'last_ip_address' => [ 'last_ip_address' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 39, 'constraint' => 39,
'default' => '', 'default' => '',
], ],
'last_login' => [ 'last_login' => [
'type' => 'DATETIME', 'type' => 'DATETIME',
'default' => NULL, 'default' => null,
], ],
'deleted' => [ 'deleted' => [
'type' => 'TINYINT', 'type' => 'TINYINT',
'constraint' => 1, 'constraint' => 1,
'default' => 0, 'default' => 0,
], ],
]); ]);
$this->forge->addKey('id', TRUE); $this->forge->addKey('id', true);
$this->forge->createTable($config->dbTableUsers, TRUE); $this->forge->createTable($config->dbTableUsers, true);
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
/**
* Drops Table
*
* @return void
*/
public function down() public function down()
{ {
$config = new AauthConfig(); $config = new AauthConfig();

58
application/Database/Migrations/20181031062503_create_user_variables.php

@ -1,28 +1,59 @@
<?php <?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 groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @copyright 2014-2017 Emre Akay
* @copyright 2018 Magefly
* @license https://opensource.org/licenses/MIT MIT License
* @link https://github.com/magefly/CodeIgniter-Aauth
*/
namespace App\Database\Migrations; namespace App\Database\Migrations;
use CodeIgniter\Database\Migration; use CodeIgniter\Database\Migration;
use Config\Aauth as AauthConfig; use Config\Aauth as AauthConfig;
/**
* Create user variables table
*
* @package CodeIgniter-Aauth
*
* @codeCoverageIgnore
*/
class Migration_create_user_variables extends Migration class Migration_create_user_variables extends Migration
{ {
/**
* Create Table
*
* @return void
*/
public function up() public function up()
{ {
$config = new AauthConfig(); $config = new AauthConfig();
$this->forge->addField([ $this->forge->addField([
'id' => [ 'id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => true,
'auto_increment' => TRUE, 'auto_increment' => true,
], ],
'user_id' => [ 'user_id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => true,
], ],
'data_key' => [ 'data_key' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 100, 'constraint' => 100,
], ],
'data_value' => [ 'data_value' => [
@ -31,17 +62,22 @@ class Migration_create_user_variables extends Migration
'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
'system' => [ 'system' => [
'type' => 'TINYINT', 'type' => 'TINYINT',
'constraint' => 1, 'constraint' => 1,
'default' => 0, 'default' => 0,
], ],
]); ]);
$this->forge->addKey('id', TRUE); $this->forge->addKey('id', true);
$this->forge->createTable($config->dbTableUserVariables, TRUE); $this->forge->createTable($config->dbTableUserVariables, true);
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
/**
* Drops Table
*
* @return void
*/
public function down() public function down()
{ {
$config = new AauthConfig(); $config = new AauthConfig();

56
application/Database/Migrations/20181031063113_create_login_attempts.php

@ -1,40 +1,76 @@
<?php <?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 groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @copyright 2014-2017 Emre Akay
* @copyright 2018 Magefly
* @license https://opensource.org/licenses/MIT MIT License
* @link https://github.com/magefly/CodeIgniter-Aauth
*/
namespace App\Database\Migrations; namespace App\Database\Migrations;
use CodeIgniter\Database\Migration; use CodeIgniter\Database\Migration;
use Config\Aauth as AauthConfig; use Config\Aauth as AauthConfig;
/**
* Create login attempts table
*
* @package CodeIgniter-Aauth
*
* @codeCoverageIgnore
*/
class Migration_create_login_attempts extends Migration class Migration_create_login_attempts extends Migration
{ {
/**
* Create Table
*
* @return void
*/
public function up() public function up()
{ {
$config = new AauthConfig(); $config = new AauthConfig();
$this->forge->addField([ $this->forge->addField([
'id' => [ 'id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => true,
'auto_increment' => TRUE, 'auto_increment' => true,
], ],
'ip_address' => [ 'ip_address' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 39, 'constraint' => 39,
'default' => 0, 'default' => 0,
], ],
'count' => [ 'count' => [
'type' => 'TINYINT', 'type' => 'TINYINT',
'constraint' => 2, 'constraint' => 2,
'default' => 0, 'default' => 0,
], ],
'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
]); ]);
$this->forge->addKey('id', TRUE); $this->forge->addKey('id', true);
$this->forge->createTable($config->dbTableLoginAttempts, TRUE); $this->forge->createTable($config->dbTableLoginAttempts, true);
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
/**
* Drops Table
*
* @return void
*/
public function down() public function down()
{ {
$config = new AauthConfig(); $config = new AauthConfig();

56
application/Database/Migrations/20181031063642_create_login_tokens.php

@ -1,44 +1,80 @@
<?php <?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 groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @copyright 2014-2017 Emre Akay
* @copyright 2018 Magefly
* @license https://opensource.org/licenses/MIT MIT License
* @link https://github.com/magefly/CodeIgniter-Aauth
*/
namespace App\Database\Migrations; namespace App\Database\Migrations;
use CodeIgniter\Database\Migration; use CodeIgniter\Database\Migration;
use Config\Aauth as AauthConfig; use Config\Aauth as AauthConfig;
/**
* Create login tokens table
*
* @package CodeIgniter-Aauth
*
* @codeCoverageIgnore
*/
class Migration_create_login_tokens extends Migration class Migration_create_login_tokens extends Migration
{ {
/**
* Create Table
*
* @return void
*/
public function up() public function up()
{ {
$config = new AauthConfig(); $config = new AauthConfig();
$this->forge->addField([ $this->forge->addField([
'id' => [ 'id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => true,
'auto_increment' => TRUE, 'auto_increment' => true,
], ],
'user_id' => [ 'user_id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'default' => 0, 'default' => 0,
], ],
'random_hash' => [ 'random_hash' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 255, 'constraint' => 255,
], ],
'selector_hash' => [ 'selector_hash' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 255, 'constraint' => 255,
], ],
'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
'expires_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'expires_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
]); ]);
$this->forge->addKey('id', TRUE); $this->forge->addKey('id', true);
$this->forge->createTable($config->dbTableLoginTokens, TRUE); $this->forge->createTable($config->dbTableLoginTokens, true);
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
/**
* Drops Table
*
* @return void
*/
public function down() public function down()
{ {
$config = new AauthConfig(); $config = new AauthConfig();

54
application/Database/Migrations/20181031064211_create_groups.php

@ -1,35 +1,71 @@
<?php <?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 groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @copyright 2014-2017 Emre Akay
* @copyright 2018 Magefly
* @license https://opensource.org/licenses/MIT MIT License
* @link https://github.com/magefly/CodeIgniter-Aauth
*/
namespace App\Database\Migrations; namespace App\Database\Migrations;
use CodeIgniter\Database\Migration; use CodeIgniter\Database\Migration;
use Config\Aauth as AauthConfig; use Config\Aauth as AauthConfig;
/**
* Create group tables
*
* @package CodeIgniter-Aauth
*
* @codeCoverageIgnore
*/
class Migration_create_groups extends Migration class Migration_create_groups extends Migration
{ {
/**
* Create Table
*
* @return void
*/
public function up() public function up()
{ {
$config = new AauthConfig(); $config = new AauthConfig();
$this->forge->addField([ $this->forge->addField([
'id' => [ 'id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => true,
'auto_increment' => TRUE, 'auto_increment' => true,
], ],
'name' => [ 'name' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 100, 'constraint' => 100,
], ],
'definition' => [ 'definition' => [
'type' => 'TEXT', 'type' => 'TEXT',
], ],
]); ]);
$this->forge->addKey('id', TRUE); $this->forge->addKey('id', true);
$this->forge->createTable($config->dbTableGroups, TRUE); $this->forge->createTable($config->dbTableGroups, true);
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
/**
* Drops Table
*
* @return void
*/
public function down() public function down()
{ {
$config = new AauthConfig(); $config = new AauthConfig();

50
application/Database/Migrations/20181031064431_create_group_to_user.php

@ -1,32 +1,68 @@
<?php <?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 groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @copyright 2014-2017 Emre Akay
* @copyright 2018 Magefly
* @license https://opensource.org/licenses/MIT MIT License
* @link https://github.com/magefly/CodeIgniter-Aauth
*/
namespace App\Database\Migrations; namespace App\Database\Migrations;
use CodeIgniter\Database\Migration; use CodeIgniter\Database\Migration;
use Config\Aauth as AauthConfig; use Config\Aauth as AauthConfig;
/**
* Create group to user table
*
* @package CodeIgniter-Aauth
*
* @codeCoverageIgnore
*/
class Migration_create_group_to_user extends Migration class Migration_create_group_to_user extends Migration
{ {
/**
* Create Table
*
* @return void
*/
public function up() public function up()
{ {
$config = new AauthConfig(); $config = new AauthConfig();
$this->forge->addField([ $this->forge->addField([
'group_id' => [ 'group_id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => true,
], ],
'user_id' => [ 'user_id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => true,
], ],
]); ]);
$this->forge->addKey(['group_id','user_id'], TRUE); $this->forge->addKey(['group_id', 'user_id'], true);
$this->forge->createTable($config->dbTableGroupToUser, TRUE); $this->forge->createTable($config->dbTableGroupToUser, true);
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
/**
* Drops Table
*
* @return void
*/
public function down() public function down()
{ {
$config = new AauthConfig(); $config = new AauthConfig();

50
application/Database/Migrations/20181031064550_create_group_to_group.php

@ -1,32 +1,68 @@
<?php <?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 groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @copyright 2014-2017 Emre Akay
* @copyright 2018 Magefly
* @license https://opensource.org/licenses/MIT MIT License
* @link https://github.com/magefly/CodeIgniter-Aauth
*/
namespace App\Database\Migrations; namespace App\Database\Migrations;
use CodeIgniter\Database\Migration; use CodeIgniter\Database\Migration;
use Config\Aauth as AauthConfig; use Config\Aauth as AauthConfig;
/**
* Create group to group table
*
* @package CodeIgniter-Aauth
*
* @codeCoverageIgnore
*/
class Migration_create_group_to_group extends Migration class Migration_create_group_to_group extends Migration
{ {
/**
* Create Table
*
* @return void
*/
public function up() public function up()
{ {
$config = new AauthConfig(); $config = new AauthConfig();
$this->forge->addField([ $this->forge->addField([
'group_id' => [ 'group_id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => true,
], ],
'subgroup_id' => [ 'subgroup_id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => true,
], ],
]); ]);
$this->forge->addKey(['group_id','subgroup_id'], TRUE); $this->forge->addKey(['group_id', 'subgroup_id'], true);
$this->forge->createTable($config->dbTableGroupToGroup, TRUE); $this->forge->createTable($config->dbTableGroupToGroup, true);
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
/**
* Drops Table
*
* @return void
*/
public function down() public function down()
{ {
$config = new AauthConfig(); $config = new AauthConfig();

54
application/Database/Migrations/20181031064714_create_perms.php

@ -1,35 +1,71 @@
<?php <?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 groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @copyright 2014-2017 Emre Akay
* @copyright 2018 Magefly
* @license https://opensource.org/licenses/MIT MIT License
* @link https://github.com/magefly/CodeIgniter-Aauth
*/
namespace App\Database\Migrations; namespace App\Database\Migrations;
use CodeIgniter\Database\Migration; use CodeIgniter\Database\Migration;
use Config\Aauth as AauthConfig; use Config\Aauth as AauthConfig;
/**
* Create perms table
*
* @package CodeIgniter-Aauth
*
* @codeCoverageIgnore
*/
class Migration_create_perms extends Migration class Migration_create_perms extends Migration
{ {
/**
* Create Table
*
* @return void
*/
public function up() public function up()
{ {
$config = new AauthConfig(); $config = new AauthConfig();
$this->forge->addField([ $this->forge->addField([
'id' => [ 'id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => true,
'auto_increment' => TRUE, 'auto_increment' => true,
], ],
'name' => [ 'name' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 100, 'constraint' => 100,
], ],
'definition' => [ 'definition' => [
'type' => 'TEXT', 'type' => 'TEXT',
], ],
]); ]);
$this->forge->addKey('id', TRUE); $this->forge->addKey('id', true);
$this->forge->createTable($config->dbTablePerms, TRUE); $this->forge->createTable($config->dbTablePerms, true);
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
/**
* Drops Table
*
* @return void
*/
public function down() public function down()
{ {
$config = new AauthConfig(); $config = new AauthConfig();

48
application/Database/Migrations/20181031065111_create_perm_to_user.php

@ -1,32 +1,68 @@
<?php <?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 groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @copyright 2014-2017 Emre Akay
* @copyright 2018 Magefly
* @license https://opensource.org/licenses/MIT MIT License
* @link https://github.com/magefly/CodeIgniter-Aauth
*/
namespace App\Database\Migrations; namespace App\Database\Migrations;
use CodeIgniter\Database\Migration; use CodeIgniter\Database\Migration;
use Config\Aauth as AauthConfig; use Config\Aauth as AauthConfig;
/**
* Create perm to user table
*
* @package CodeIgniter-Aauth
*
* @codeCoverageIgnore
*/
class Migration_create_perm_to_user extends Migration class Migration_create_perm_to_user extends Migration
{ {
/**
* Create Table
*
* @return void
*/
public function up() public function up()
{ {
$config = new AauthConfig(); $config = new AauthConfig();
$this->forge->addField([ $this->forge->addField([
'perm_id' => [ 'perm_id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => true,
], ],
'user_id' => [ 'user_id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => true,
], ],
]); ]);
$this->forge->addKey(['perm_id','user_id'], TRUE); $this->forge->addKey(['perm_id', 'user_id'], true);
$this->forge->createTable($config->dbTablePermToUser, TRUE); $this->forge->createTable($config->dbTablePermToUser, true);
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
/**
* Drops Table
*
* @return void
*/
public function down() public function down()
{ {
$config = new AauthConfig(); $config = new AauthConfig();

50
application/Database/Migrations/20181031065240_create_perm_to_group.php

@ -1,32 +1,68 @@
<?php <?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 groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @copyright 2014-2017 Emre Akay
* @copyright 2018 Magefly
* @license https://opensource.org/licenses/MIT MIT License
* @link https://github.com/magefly/CodeIgniter-Aauth
*/
namespace App\Database\Migrations; namespace App\Database\Migrations;
use CodeIgniter\Database\Migration; use CodeIgniter\Database\Migration;
use Config\Aauth as AauthConfig; use Config\Aauth as AauthConfig;
/**
* Create perm to group table
*
* @package CodeIgniter-Aauth
*
* @codeCoverageIgnore
*/
class Migration_create_perm_to_group extends Migration class Migration_create_perm_to_group extends Migration
{ {
/**
* Create Table
*
* @return void
*/
public function up() public function up()
{ {
$config = new AauthConfig(); $config = new AauthConfig();
$this->forge->addField([ $this->forge->addField([
'perm_id' => [ 'perm_id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => true,
], ],
'group_id' => [ 'group_id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => true,
], ],
]); ]);
$this->forge->addKey(['perm_id','user_id'], TRUE); $this->forge->addKey(['perm_id', 'user_id'], true);
$this->forge->createTable($config->dbTablePermToGroup, TRUE); $this->forge->createTable($config->dbTablePermToGroup, true);
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
/**
* Drops Table
*
* @return void
*/
public function down() public function down()
{ {
$config = new AauthConfig(); $config = new AauthConfig();

40
application/Database/Migrations/20181031072542_create_default_groups.php

@ -1,16 +1,46 @@
<?php <?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 groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @copyright 2014-2017 Emre Akay
* @copyright 2018 Magefly
* @license https://opensource.org/licenses/MIT MIT License
* @link https://github.com/magefly/CodeIgniter-Aauth
*/
namespace App\Database\Migrations; namespace App\Database\Migrations;
use CodeIgniter\Database\Migration; use CodeIgniter\Database\Migration;
use Config\Aauth as AauthConfig; use Config\Aauth as AauthConfig;
/**
* Create default groups
*
* @package CodeIgniter-Aauth
*
* @codeCoverageIgnore
*/
class Migration_create_default_groups extends Migration class Migration_create_default_groups extends Migration
{ {
/**
* Create Table
*
* @return void
*/
public function up() public function up()
{ {
$config = new AauthConfig(); $config = new AauthConfig();
$data = [
$data = [
[ [
'name' => $config->adminGroup, 'name' => $config->adminGroup,
'definition' => 'Administators', 'definition' => 'Administators',
@ -30,8 +60,14 @@ class Migration_create_default_groups extends Migration
//-------------------------------------------------------------------- //--------------------------------------------------------------------
/**
* Drops Table
*
* @return void
*/
public function down() public function down()
{ {
$config = new AauthConfig();
$this->db->table($config->dbTableGroups)->truncate(); $this->db->table($config->dbTableGroups)->truncate();
} }
} }

40
application/Database/Migrations/20181031072914_create_default_admin.php

@ -1,16 +1,46 @@
<?php <?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 groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @copyright 2014-2017 Emre Akay
* @copyright 2018 Magefly
* @license https://opensource.org/licenses/MIT MIT License
* @link https://github.com/magefly/CodeIgniter-Aauth
*/
namespace App\Database\Migrations; namespace App\Database\Migrations;
use CodeIgniter\Database\Migration; use CodeIgniter\Database\Migration;
use Config\Aauth as AauthConfig; use Config\Aauth as AauthConfig;
/**
* Create default admin
*
* @package CodeIgniter-Aauth
*
* @codeCoverageIgnore
*/
class Migration_create_default_admin extends Migration class Migration_create_default_admin extends Migration
{ {
/**
* Create Table
*
* @return void
*/
public function up() public function up()
{ {
$config = new AauthConfig(); $config = new AauthConfig();
$data = [
$data = [
'username' => 'admin', 'username' => 'admin',
'email' => 'admin@example.com', 'email' => 'admin@example.com',
'password' => password_hash('password123456', $config->passwordHashAlgo, $config->passwordHashOptions), 'password' => password_hash('password123456', $config->passwordHashAlgo, $config->passwordHashOptions),
@ -34,8 +64,14 @@ class Migration_create_default_admin extends Migration
//-------------------------------------------------------------------- //--------------------------------------------------------------------
/**
* Drops Table
*
* @return void
*/
public function down() public function down()
{ {
$config = new AauthConfig();
$this->db->table($config->dbTableUsers)->truncate(); $this->db->table($config->dbTableUsers)->truncate();
$this->db->table($config->dbTableGroupToUser)->truncate(); $this->db->table($config->dbTableGroupToUser)->truncate();
} }

Loading…
Cancel
Save