forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserSeeder.php
More file actions
76 lines (65 loc) · 2.21 KB
/
UserSeeder.php
File metadata and controls
76 lines (65 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
use Laravel\Passport\ClientRepository;
use ProcessMaker\Models\Group;
use ProcessMaker\Models\GroupMember;
use ProcessMaker\Models\User;
class UserSeeder extends Seeder
{
public static $INSTALLER_ADMIN_USERNAME = 'admin';
public static $INSTALLER_ADMIN_PASSWORD = 'admin';
public static $INSTALLER_ADMIN_EMAIL = 'admin@processmaker.com';
public static $INSTALLER_ADMIN_FIRSTNAME = 'Admin';
public static $INSTALLER_ADMIN_LASTNAME = 'User';
/**
* Run the database seeds.
*
* @return void
*/
public function run(ClientRepository $clients)
{
//Create admin user
$user = User::updateOrCreate([
'username' => self::$INSTALLER_ADMIN_USERNAME,
'is_administrator' => true,
], [
'username' => self::$INSTALLER_ADMIN_USERNAME,
'password' => Hash::make(env('INSTALL_ADMIN_PASSWORD', self::$INSTALLER_ADMIN_PASSWORD)),
'email' => self::$INSTALLER_ADMIN_EMAIL,
'firstname' => self::$INSTALLER_ADMIN_FIRSTNAME,
'lastname' => self::$INSTALLER_ADMIN_LASTNAME,
'address' => null,
'city' => null,
'state' => null,
'postal' => null,
'country' => null,
'phone' => null,
'fax' => null,
'cell' => null,
'title' => null,
'birthdate' => null,
'timezone' => 'America/Los_Angeles',
'datetime_format' => 'm/d/Y H:i',
'language' => 'en',
'status' => 'ACTIVE',
]);
// Create client so we can generate tokens
$clients->createPersonalAccessClient(
null,
'PmApi',
'http://localhost'
);
// Create client OAuth (for 3-legged auth)
$clients->create(
null,
'Swagger UI Auth',
env('APP_URL', 'http://localhost') . '/api/oauth2-callback'
);
// Allow users get at token using the password grant flow
$clients->createPasswordGrantClient(
null, 'Password Grant', 'http://localhost'
);
}
}