1 | <?php |
||
33 | class StepPermissionCondition extends AbstractPermissionCondition |
||
34 | { |
||
35 | /** |
||
36 | * If a workflow is not started it does not have a current step. So you can decide if it should be allowed. |
||
37 | * |
||
38 | * @var bool |
||
39 | */ |
||
40 | private $allowStartTransition; |
||
41 | |||
42 | /** |
||
43 | * StepPermissionCondition constructor. |
||
44 | * |
||
45 | * @param User $user Security user instance. |
||
46 | * @param bool $grantAccessByDefault Default access value if no permission is found. |
||
47 | * @param bool $allowStartTransition Allow start transition. |
||
48 | */ |
||
49 | public function __construct(User $user, bool $grantAccessByDefault = false, bool $allowStartTransition = true) |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | public function match(Transition $transition, Item $item, Context $context, ErrorCollection $errorCollection): bool |
||
89 | |||
90 | /** |
||
91 | * Get role of current step. |
||
92 | * |
||
93 | * @param Transition $transition The transition being in. |
||
94 | * @param Item $item The entity being transits. |
||
95 | * |
||
96 | * @return Permission|null |
||
97 | */ |
||
98 | protected function getStepPermission(Transition $transition, Item $item):? Permission |
||
106 | } |
||
107 |