fix: [initial user] generation fixed
- requires a default organisation + org link nowpull/92/head
parent
8c8aba3fbc
commit
eb0a67327a
|
@ -12,6 +12,7 @@ use \Cake\Http\Session;
|
||||||
use Cake\Http\Client;
|
use Cake\Http\Client;
|
||||||
use Cake\Utility\Security;
|
use Cake\Utility\Security;
|
||||||
use Cake\Core\Configure;
|
use Cake\Core\Configure;
|
||||||
|
use Cake\Utility\Text;
|
||||||
|
|
||||||
class UsersTable extends AppTable
|
class UsersTable extends AppTable
|
||||||
{
|
{
|
||||||
|
@ -105,6 +106,12 @@ class UsersTable extends AppTable
|
||||||
'perm_admin' => 1
|
'perm_admin' => 1
|
||||||
]);
|
]);
|
||||||
$this->Roles->save($role);
|
$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');
|
$this->Individuals = TableRegistry::get('Individuals');
|
||||||
$individual = $this->Individuals->newEntity([
|
$individual = $this->Individuals->newEntity([
|
||||||
'email' => 'admin@admin.test',
|
'email' => 'admin@admin.test',
|
||||||
|
@ -116,6 +123,7 @@ class UsersTable extends AppTable
|
||||||
'username' => 'admin',
|
'username' => 'admin',
|
||||||
'password' => 'Password1234',
|
'password' => 'Password1234',
|
||||||
'individual_id' => $individual->id,
|
'individual_id' => $individual->id,
|
||||||
|
'oganisation_id' => $organisation->id,
|
||||||
'role_id' => $role->id
|
'role_id' => $role->id
|
||||||
]);
|
]);
|
||||||
$this->save($user);
|
$this->save($user);
|
||||||
|
|
Loading…
Reference in New Issue