Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 3 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| GroupPermission | |
0.00% |
0 / 3 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| getGroup | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Jingga |
| 4 | * |
| 5 | * PHP Version 8.1 |
| 6 | * |
| 7 | * @package Modules\Admin\Models |
| 8 | * @copyright Dennis Eichhorn |
| 9 | * @license OMS License 2.0 |
| 10 | * @version 1.0.0 |
| 11 | * @link https://jingga.app |
| 12 | */ |
| 13 | declare(strict_types=1); |
| 14 | |
| 15 | namespace Modules\Admin\Models; |
| 16 | |
| 17 | use phpOMS\Account\PermissionAbstract; |
| 18 | use phpOMS\Account\PermissionType; |
| 19 | |
| 20 | /** |
| 21 | * Group permission class. |
| 22 | * |
| 23 | * A single permission for a group consisting of read, create, modify, delete and permission flags. |
| 24 | * |
| 25 | * @package Modules\Admin\Models |
| 26 | * @license OMS License 2.0 |
| 27 | * @link https://jingga.app |
| 28 | * @since 1.0.0 |
| 29 | */ |
| 30 | class GroupPermission extends PermissionAbstract |
| 31 | { |
| 32 | /** |
| 33 | * Group id |
| 34 | * |
| 35 | * @var int |
| 36 | * @since 1.0.0 |
| 37 | */ |
| 38 | public int $group = 0; |
| 39 | |
| 40 | /** |
| 41 | * Constructor. |
| 42 | * |
| 43 | * @param int $group Group id |
| 44 | * @param null|int $unit Unit to check (null if all are acceptable) |
| 45 | * @param null|int $app App to check (null if all are acceptable) |
| 46 | * @param null|string $module Module to check (null if all are acceptable) |
| 47 | * @param null|string $from Module providing this permission |
| 48 | * @param null|int $category Category (e.g. customer) (null if all are acceptable) |
| 49 | * @param null|int $element (e.g. customer id) (null if all are acceptable) |
| 50 | * @param null|int $component (e.g. address) (null if all are acceptable) |
| 51 | * @param int $permission Permission to check |
| 52 | * |
| 53 | * @since 1.0.0 |
| 54 | */ |
| 55 | public function __construct( |
| 56 | int $group = 0, |
| 57 | int $unit = null, |
| 58 | int $app = null, |
| 59 | string $module = null, |
| 60 | string $from = null, |
| 61 | int $category = null, |
| 62 | int $element = null, |
| 63 | int $component = null, |
| 64 | int $permission = PermissionType::NONE |
| 65 | ) { |
| 66 | $this->group = $group; |
| 67 | parent::__construct($unit, $app, $module, $from, $category, $element, $component, $permission); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Get group id |
| 72 | * |
| 73 | * @return int |
| 74 | * |
| 75 | * @since 1.0.0 |
| 76 | */ |
| 77 | public function getGroup() : int |
| 78 | { |
| 79 | return $this->group; |
| 80 | } |
| 81 | } |