2019-10-20 14:35:19 +02:00
|
|
|
<?php
|
2020-02-22 18:14:36 +01:00
|
|
|
/**
|
|
|
|
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
|
|
|
*
|
|
|
|
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published
|
|
|
|
* by the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2020-01-05 15:46:58 +01:00
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2019-11-01 13:40:30 +01:00
|
|
|
/**
|
2019-11-09 00:47:20 +01:00
|
|
|
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
2019-11-01 13:40:30 +01:00
|
|
|
*
|
|
|
|
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
2019-10-20 14:35:19 +02:00
|
|
|
|
|
|
|
namespace App\DataFixtures;
|
|
|
|
|
|
|
|
use App\Entity\UserSystem\Group;
|
|
|
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
2020-03-29 23:13:25 +02:00
|
|
|
use Doctrine\Persistence\ObjectManager;
|
2019-10-20 14:35:19 +02:00
|
|
|
|
|
|
|
class GroupFixtures extends Fixture
|
|
|
|
{
|
|
|
|
public const ADMINS = 'group-admin';
|
|
|
|
public const USERS = 'group-users';
|
|
|
|
public const READONLY = 'group-readonly';
|
|
|
|
|
2020-01-05 15:46:58 +01:00
|
|
|
public function load(ObjectManager $manager): void
|
2019-10-20 14:35:19 +02:00
|
|
|
{
|
|
|
|
$admins = new Group();
|
|
|
|
$admins->setName('admins');
|
2019-10-26 22:27:04 +02:00
|
|
|
//Perm values taken from Version 1
|
|
|
|
$admins->getPermissions()->setRawPermissionValues([
|
2020-01-05 22:49:00 +01:00
|
|
|
'system' => 21,
|
|
|
|
'groups' => 1365,
|
|
|
|
'users' => 87381,
|
|
|
|
'self' => 85,
|
|
|
|
'config' => 85,
|
|
|
|
'database' => 21,
|
|
|
|
'parts' => 1431655765,
|
|
|
|
'parts_name' => 5,
|
|
|
|
'parts_description' => 5,
|
|
|
|
'parts_footprint' => 5,
|
|
|
|
'parts_manufacturer' => 5,
|
|
|
|
'parts_comment' => 5,
|
|
|
|
'parts_order' => 5,
|
|
|
|
'parts_orderdetails' => 341,
|
|
|
|
'parts_prices' => 341,
|
|
|
|
'parts_attachments' => 341,
|
|
|
|
'devices' => 5461,
|
|
|
|
'devices_parts' => 325,
|
|
|
|
'storelocations' => 5461,
|
|
|
|
'footprints' => 5461,
|
|
|
|
'categories' => 5461,
|
|
|
|
'suppliers' => 5461,
|
|
|
|
'manufacturers' => 5461,
|
|
|
|
'attachment_types' => 1365,
|
2020-06-03 22:19:59 +02:00
|
|
|
'tools' => 349525,
|
2020-05-10 13:28:01 +02:00
|
|
|
'labels' => 87381,
|
2020-01-05 22:49:00 +01:00
|
|
|
'parts_category' => 5,
|
|
|
|
'parts_minamount' => 5,
|
|
|
|
'parts_lots' => 85,
|
|
|
|
'parts_tags' => 5,
|
|
|
|
'parts_unit' => 5,
|
|
|
|
'parts_mass' => 5,
|
|
|
|
'parts_status' => 5,
|
|
|
|
'parts_mpn' => 5,
|
|
|
|
'currencies' => 5461,
|
2020-01-05 15:46:58 +01:00
|
|
|
'measurement_units' => 5461,
|
2019-10-26 22:27:04 +02:00
|
|
|
]);
|
2019-10-20 14:35:19 +02:00
|
|
|
$this->setReference(self::ADMINS, $admins);
|
|
|
|
$manager->persist($admins);
|
|
|
|
|
|
|
|
$readonly = new Group();
|
|
|
|
$readonly->setName('readonly');
|
2019-10-26 22:27:04 +02:00
|
|
|
$readonly->getPermissions()->setRawPermissionValues([
|
2020-01-05 22:49:00 +01:00
|
|
|
'system' => 2,
|
|
|
|
'groups' => 2730,
|
|
|
|
'users' => 43690,
|
|
|
|
'self' => 25,
|
|
|
|
'config' => 170,
|
|
|
|
'database' => 42,
|
|
|
|
'parts' => 2778027689,
|
|
|
|
'parts_name' => 9,
|
|
|
|
'parts_description' => 9,
|
|
|
|
'parts_footprint' => 9,
|
|
|
|
'parts_manufacturer' => 9,
|
|
|
|
'parts_comment' => 9,
|
|
|
|
'parts_order' => 9,
|
|
|
|
'parts_orderdetails' => 681,
|
|
|
|
'parts_prices' => 681,
|
|
|
|
'parts_attachments' => 681,
|
|
|
|
'devices' => 1705,
|
|
|
|
'devices_parts' => 649,
|
|
|
|
'storelocations' => 1705,
|
|
|
|
'footprints' => 1705,
|
|
|
|
'categories' => 1705,
|
|
|
|
'suppliers' => 1705,
|
|
|
|
'manufacturers' => 1705,
|
|
|
|
'attachment_types' => 681,
|
2020-05-10 13:28:01 +02:00
|
|
|
'tools' => 87382,
|
|
|
|
'labels' => 173737,
|
2020-01-05 22:49:00 +01:00
|
|
|
'parts_category' => 9,
|
|
|
|
'parts_minamount' => 9,
|
|
|
|
'parts_lots' => 169,
|
|
|
|
'parts_tags' => 9,
|
|
|
|
'parts_unit' => 9,
|
|
|
|
'parts_mass' => 9,
|
|
|
|
'parts_status' => 9,
|
|
|
|
'parts_mpn' => 9,
|
|
|
|
'currencies' => 9897,
|
2020-01-05 15:46:58 +01:00
|
|
|
'measurement_units' => 9897,
|
2019-10-26 22:27:04 +02:00
|
|
|
]);
|
2019-10-20 14:35:19 +02:00
|
|
|
$this->setReference(self::READONLY, $readonly);
|
|
|
|
$manager->persist($readonly);
|
|
|
|
|
|
|
|
$users = new Group();
|
|
|
|
$users->setName('users');
|
2019-10-26 22:27:04 +02:00
|
|
|
$users->getPermissions()->setRawPermissionValues([
|
2020-01-05 22:49:00 +01:00
|
|
|
'system' => 42,
|
|
|
|
'groups' => 2730,
|
|
|
|
'users' => 43690,
|
|
|
|
'self' => 89,
|
|
|
|
'config' => 105,
|
|
|
|
'database' => 41,
|
|
|
|
'parts' => 1431655765,
|
|
|
|
'parts_name' => 5,
|
|
|
|
'parts_description' => 5,
|
|
|
|
'parts_footprint' => 5,
|
|
|
|
'parts_manufacturer' => 5,
|
|
|
|
'parts_comment' => 5,
|
|
|
|
'parts_order' => 5,
|
|
|
|
'parts_orderdetails' => 341,
|
|
|
|
'parts_prices' => 341,
|
|
|
|
'parts_attachments' => 341,
|
|
|
|
'devices' => 5461,
|
|
|
|
'devices_parts' => 325,
|
|
|
|
'storelocations' => 5461,
|
|
|
|
'footprints' => 5461,
|
|
|
|
'categories' => 5461,
|
|
|
|
'suppliers' => 5461,
|
|
|
|
'manufacturers' => 5461,
|
|
|
|
'attachment_types' => 1365,
|
2020-05-10 13:28:01 +02:00
|
|
|
'tools' => 87381,
|
|
|
|
'labels' => 91477,
|
2020-01-05 22:49:00 +01:00
|
|
|
'parts_category' => 5,
|
|
|
|
'parts_minamount' => 5,
|
|
|
|
'parts_lots' => 85,
|
|
|
|
'parts_tags' => 5,
|
|
|
|
'parts_unit' => 5,
|
|
|
|
'parts_mass' => 5,
|
|
|
|
'parts_status' => 5,
|
|
|
|
'parts_mpn' => 5,
|
|
|
|
'currencies' => 5461,
|
2020-01-05 15:46:58 +01:00
|
|
|
'measurement_units' => 5461,
|
2019-10-26 22:27:04 +02:00
|
|
|
]);
|
2019-10-20 14:35:19 +02:00
|
|
|
$this->setReference(self::USERS, $users);
|
|
|
|
$manager->persist($users);
|
|
|
|
|
|
|
|
$manager->flush();
|
|
|
|
}
|
|
|
|
}
|