2020-07-31 16:05:10 +00:00
|
|
|
<?php
|
2020-08-04 11:25:22 +00:00
|
|
|
|
2021-06-08 09:52:11 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-07-31 16:05:10 +00:00
|
|
|
/**
|
2021-05-19 16:35:13 +00:00
|
|
|
* Class TestSeeder Inserts a superadmin user in the database
|
2020-07-31 16:05:10 +00:00
|
|
|
*
|
2022-02-19 16:06:11 +00:00
|
|
|
* @copyright 2020 Ad Aures
|
2020-07-31 16:05:10 +00:00
|
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
|
|
* @link https://castopod.org/
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Database\Seeds;
|
|
|
|
|
|
|
|
use CodeIgniter\Database\Seeder;
|
|
|
|
|
|
|
|
class TestSeeder extends Seeder
|
|
|
|
{
|
2021-05-06 14:00:48 +00:00
|
|
|
public function run(): void
|
2020-07-31 16:05:10 +00:00
|
|
|
{
|
2022-10-15 11:22:08 +00:00
|
|
|
helper('setting');
|
|
|
|
|
2021-05-19 16:35:13 +00:00
|
|
|
/**
|
2022-10-15 11:22:08 +00:00
|
|
|
* Inserts an owner with the following credentials: admin: `admin@example.com` password: `AGUehL3P`
|
2020-07-31 16:05:10 +00:00
|
|
|
*/
|
2021-05-19 16:35:13 +00:00
|
|
|
$this->db->table('users')
|
|
|
|
->insert([
|
2023-06-12 14:47:38 +00:00
|
|
|
'id' => 1,
|
2021-05-19 16:35:13 +00:00
|
|
|
'username' => 'admin',
|
2022-10-15 11:22:08 +00:00
|
|
|
'is_owner' => 1,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->db->table('auth_identities')
|
|
|
|
->insert([
|
2023-06-12 14:47:38 +00:00
|
|
|
'id' => 1,
|
2022-10-15 11:22:08 +00:00
|
|
|
'user_id' => 1,
|
2023-06-12 14:47:38 +00:00
|
|
|
'type' => 'email_password',
|
|
|
|
'secret' => 'admin@example.com',
|
2022-10-15 11:22:08 +00:00
|
|
|
'secret2' => '$2y$10$TXJEHX/djW8jtzgpDVf7dOOCGo5rv1uqtAYWdwwwkttQcDkAeB2.6',
|
2021-05-19 16:35:13 +00:00
|
|
|
]);
|
2021-05-06 14:00:48 +00:00
|
|
|
|
2020-07-31 16:05:10 +00:00
|
|
|
$this->db
|
|
|
|
->table('auth_groups_users')
|
2021-05-19 16:35:13 +00:00
|
|
|
->insert([
|
|
|
|
'user_id' => 1,
|
2023-06-12 14:47:38 +00:00
|
|
|
'group' => setting('AuthGroups.mostPowerfulGroup'),
|
2021-05-19 16:35:13 +00:00
|
|
|
]);
|
2020-07-31 16:05:10 +00:00
|
|
|
}
|
|
|
|
}
|