1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). |
7
|
|
|
* |
8
|
|
|
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics) |
9
|
|
|
* |
10
|
|
|
* This program is free software; you can redistribute it and/or |
11
|
|
|
* modify it under the terms of the GNU General Public License |
12
|
|
|
* as published by the Free Software Foundation; either version 2 |
13
|
|
|
* of the License, or (at your option) any later version. |
14
|
|
|
* |
15
|
|
|
* This program is distributed in the hope that it will be useful, |
16
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
17
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18
|
|
|
* GNU General Public License for more details. |
19
|
|
|
* |
20
|
|
|
* You should have received a copy of the GNU General Public License |
21
|
|
|
* along with this program; if not, write to the Free Software |
22
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
namespace App\DataFixtures; |
26
|
|
|
|
27
|
|
|
use App\Entity\UserSystem\Group; |
28
|
|
|
use Doctrine\Bundle\FixturesBundle\Fixture; |
29
|
|
|
use Doctrine\Common\Persistence\ObjectManager; |
30
|
|
|
|
31
|
|
|
class GroupFixtures extends Fixture |
32
|
|
|
{ |
33
|
|
|
public const ADMINS = 'group-admin'; |
34
|
|
|
public const USERS = 'group-users'; |
35
|
|
|
public const READONLY = 'group-readonly'; |
36
|
|
|
|
37
|
|
|
public function load(ObjectManager $manager): void |
38
|
|
|
{ |
39
|
|
|
$admins = new Group(); |
40
|
|
|
$admins->setName('admins'); |
41
|
|
|
//Perm values taken from Version 1 |
42
|
|
|
$admins->getPermissions()->setRawPermissionValues([ |
43
|
|
|
'system' => 21, |
44
|
|
|
'groups' => 1365, |
45
|
|
|
'users' => 87381, |
46
|
|
|
'self' => 85, |
47
|
|
|
'config' => 85, |
48
|
|
|
'database' => 21, |
49
|
|
|
'parts' => 1431655765, |
50
|
|
|
'parts_name' => 5, |
51
|
|
|
'parts_description' => 5, |
52
|
|
|
'parts_footprint' => 5, |
53
|
|
|
'parts_manufacturer' => 5, |
54
|
|
|
'parts_comment' => 5, |
55
|
|
|
'parts_order' => 5, |
56
|
|
|
'parts_orderdetails' => 341, |
57
|
|
|
'parts_prices' => 341, |
58
|
|
|
'parts_attachments' => 341, |
59
|
|
|
'devices' => 5461, |
60
|
|
|
'devices_parts' => 325, |
61
|
|
|
'storelocations' => 5461, |
62
|
|
|
'footprints' => 5461, |
63
|
|
|
'categories' => 5461, |
64
|
|
|
'suppliers' => 5461, |
65
|
|
|
'manufacturers' => 5461, |
66
|
|
|
'attachment_types' => 1365, |
67
|
|
|
'tools' => 1365, |
68
|
|
|
'labels' => 21, |
69
|
|
|
'parts_category' => 5, |
70
|
|
|
'parts_minamount' => 5, |
71
|
|
|
'parts_lots' => 85, |
72
|
|
|
'parts_tags' => 5, |
73
|
|
|
'parts_unit' => 5, |
74
|
|
|
'parts_mass' => 5, |
75
|
|
|
'parts_status' => 5, |
76
|
|
|
'parts_mpn' => 5, |
77
|
|
|
'currencies' => 5461, |
78
|
|
|
'measurement_units' => 5461, |
79
|
|
|
]); |
80
|
|
|
$this->setReference(self::ADMINS, $admins); |
81
|
|
|
$manager->persist($admins); |
82
|
|
|
|
83
|
|
|
$readonly = new Group(); |
84
|
|
|
$readonly->setName('readonly'); |
85
|
|
|
$readonly->getPermissions()->setRawPermissionValues([ |
86
|
|
|
'system' => 2, |
87
|
|
|
'groups' => 2730, |
88
|
|
|
'users' => 43690, |
89
|
|
|
'self' => 25, |
90
|
|
|
'config' => 170, |
91
|
|
|
'database' => 42, |
92
|
|
|
'parts' => 2778027689, |
93
|
|
|
'parts_name' => 9, |
94
|
|
|
'parts_description' => 9, |
95
|
|
|
'parts_footprint' => 9, |
96
|
|
|
'parts_manufacturer' => 9, |
97
|
|
|
'parts_comment' => 9, |
98
|
|
|
'parts_order' => 9, |
99
|
|
|
'parts_orderdetails' => 681, |
100
|
|
|
'parts_prices' => 681, |
101
|
|
|
'parts_attachments' => 681, |
102
|
|
|
'devices' => 1705, |
103
|
|
|
'devices_parts' => 649, |
104
|
|
|
'storelocations' => 1705, |
105
|
|
|
'footprints' => 1705, |
106
|
|
|
'categories' => 1705, |
107
|
|
|
'suppliers' => 1705, |
108
|
|
|
'manufacturers' => 1705, |
109
|
|
|
'attachment_types' => 681, |
110
|
|
|
'tools' => 1366, |
111
|
|
|
'labels' => 165, |
112
|
|
|
'parts_category' => 9, |
113
|
|
|
'parts_minamount' => 9, |
114
|
|
|
'parts_lots' => 169, |
115
|
|
|
'parts_tags' => 9, |
116
|
|
|
'parts_unit' => 9, |
117
|
|
|
'parts_mass' => 9, |
118
|
|
|
'parts_status' => 9, |
119
|
|
|
'parts_mpn' => 9, |
120
|
|
|
'currencies' => 9897, |
121
|
|
|
'measurement_units' => 9897, |
122
|
|
|
]); |
123
|
|
|
$this->setReference(self::READONLY, $readonly); |
124
|
|
|
$manager->persist($readonly); |
125
|
|
|
|
126
|
|
|
$users = new Group(); |
127
|
|
|
$users->setName('users'); |
128
|
|
|
$users->getPermissions()->setRawPermissionValues([ |
129
|
|
|
'system' => 42, |
130
|
|
|
'groups' => 2730, |
131
|
|
|
'users' => 43690, |
132
|
|
|
'self' => 89, |
133
|
|
|
'config' => 105, |
134
|
|
|
'database' => 41, |
135
|
|
|
'parts' => 1431655765, |
136
|
|
|
'parts_name' => 5, |
137
|
|
|
'parts_description' => 5, |
138
|
|
|
'parts_footprint' => 5, |
139
|
|
|
'parts_manufacturer' => 5, |
140
|
|
|
'parts_comment' => 5, |
141
|
|
|
'parts_order' => 5, |
142
|
|
|
'parts_orderdetails' => 341, |
143
|
|
|
'parts_prices' => 341, |
144
|
|
|
'parts_attachments' => 341, |
145
|
|
|
'devices' => 5461, |
146
|
|
|
'devices_parts' => 325, |
147
|
|
|
'storelocations' => 5461, |
148
|
|
|
'footprints' => 5461, |
149
|
|
|
'categories' => 5461, |
150
|
|
|
'suppliers' => 5461, |
151
|
|
|
'manufacturers' => 5461, |
152
|
|
|
'attachment_types' => 1365, |
153
|
|
|
'tools' => 1365, |
154
|
|
|
'labels' => 85, |
155
|
|
|
'parts_category' => 5, |
156
|
|
|
'parts_minamount' => 5, |
157
|
|
|
'parts_lots' => 85, |
158
|
|
|
'parts_tags' => 5, |
159
|
|
|
'parts_unit' => 5, |
160
|
|
|
'parts_mass' => 5, |
161
|
|
|
'parts_status' => 5, |
162
|
|
|
'parts_mpn' => 5, |
163
|
|
|
'currencies' => 5461, |
164
|
|
|
'measurement_units' => 5461, |
165
|
|
|
]); |
166
|
|
|
$this->setReference(self::USERS, $users); |
167
|
|
|
$manager->persist($users); |
168
|
|
|
|
169
|
|
|
$manager->flush(); |
170
|
|
|
} |
171
|
|
|
} |
172
|
|
|
|