1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright 2016 SURFnet B.V. |
5
|
|
|
* |
6
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
7
|
|
|
* you may not use this file except in compliance with the License. |
8
|
|
|
* You may obtain a copy of the License at |
9
|
|
|
* |
10
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
11
|
|
|
* |
12
|
|
|
* Unless required by applicable law or agreed to in writing, software |
13
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
14
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15
|
|
|
* See the License for the specific language governing permissions and |
16
|
|
|
* limitations under the License. |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
namespace Surfnet\StepupMiddleware\ApiBundle\Configuration\Projector; |
20
|
|
|
|
21
|
|
|
use Broadway\ReadModel\Projector; |
22
|
|
|
use Surfnet\Stepup\Configuration\Event\SelectRaaOptionChangedEvent; |
23
|
|
|
use Surfnet\Stepup\Configuration\Event\UseRaaOptionChangedEvent; |
24
|
|
|
use Surfnet\Stepup\Configuration\Event\UseRaOptionChangedEvent; |
25
|
|
|
use Surfnet\StepupMiddleware\ApiBundle\Configuration\Repository\InstitutionAuthorizationRepository; |
26
|
|
|
|
27
|
|
|
final class InstitutionAuthorizationProjector extends Projector |
28
|
|
|
{ |
29
|
|
|
/** |
30
|
|
|
* @var InstitutionAuthorizationRepository |
31
|
|
|
*/ |
32
|
|
|
private $institutionAuthorizationRepository; |
33
|
|
|
|
34
|
|
|
public function __construct( |
35
|
|
|
InstitutionAuthorizationRepository $institutionAuthorizationRepository |
36
|
|
|
) { |
37
|
|
|
$this->institutionAuthorizationRepository = $institutionAuthorizationRepository; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function applyUseRaOptionChangedEvent(UseRaOptionChangedEvent $event) |
41
|
|
|
{ |
42
|
|
|
$this->institutionAuthorizationRepository->saveInstitutionOption( |
43
|
|
|
$event->institution, |
44
|
|
|
$event->useRaOption |
45
|
|
|
); |
46
|
|
|
} |
47
|
|
|
public function applyUseRaaOptionChangedEvent(UseRaaOptionChangedEvent $event) |
48
|
|
|
{ |
49
|
|
|
$this->institutionAuthorizationRepository->saveInstitutionOption( |
50
|
|
|
$event->institution, |
51
|
|
|
$event->useRaaOption |
52
|
|
|
); |
53
|
|
|
} |
54
|
|
|
public function applySelectRaaOptionChangedEvent(SelectRaaOptionChangedEvent $event) |
55
|
|
|
{ |
56
|
|
|
$this->institutionAuthorizationRepository->saveInstitutionOption( |
57
|
|
|
$event->institution, |
58
|
|
|
$event->selectRaaOption |
59
|
|
|
); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|