fix: [initial user] generation fixed

- requires a default organisation + org link now
pull/92/head
iglocska 2021-11-24 14:46:34 +01:00
parent 8c8aba3fbc
commit eb0a67327a
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 8 additions and 0 deletions

View File

@ -12,6 +12,7 @@ use \Cake\Http\Session;
use Cake\Http\Client;
use Cake\Utility\Security;
use Cake\Core\Configure;
use Cake\Utility\Text;
class UsersTable extends AppTable
{
@ -105,6 +106,12 @@ class UsersTable extends AppTable
'perm_admin' => 1
]);
$this->Roles->save($role);
$this->Organisations = TableRegistry::get('Organisations');
$organisation = $this->Organisations->newEntity([
'name' => 'default_organisation',
'uuid' => Text::uuid()
]);
$this->Organisations->save($organisation);
$this->Individuals = TableRegistry::get('Individuals');
$individual = $this->Individuals->newEntity([
'email' => 'admin@admin.test',
@ -116,6 +123,7 @@ class UsersTable extends AppTable
'username' => 'admin',
'password' => 'Password1234',
'individual_id' => $individual->id,
'oganisation_id' => $organisation->id,
'role_id' => $role->id
]);
$this->save($user);