1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright 2018 SURFnet bv |
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\Authorization\Value; |
20
|
|
|
|
21
|
|
|
use Surfnet\Stepup\Identity\Value\Institution; |
22
|
|
|
use Surfnet\StepupMiddleware\ApiBundle\Identity\Entity\Identity; |
23
|
|
|
|
24
|
|
|
class InstitutionAuthorizationContext implements InstitutionAuthorizationContextInterface |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* @var Identity |
28
|
|
|
*/ |
29
|
|
|
private $actorId; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var Institution |
33
|
|
|
*/ |
34
|
|
|
private $actorInstitution; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var InstitutionRoleSet |
38
|
|
|
*/ |
39
|
|
|
private $roleRequirements; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* AuthorizationContext constructor. |
43
|
|
|
* @param string $actorId |
44
|
|
|
* @param string $actorInstitution |
45
|
|
|
* @param InstitutionRoleSetInterface $roleRequirements |
46
|
|
|
*/ |
47
|
|
|
public function __construct($actorId, $actorInstitution, InstitutionRoleSetInterface $roleRequirements) |
48
|
|
|
{ |
49
|
|
|
$this->actorId = $actorId; |
|
|
|
|
50
|
|
|
$this->actorInstitution = $actorInstitution; |
|
|
|
|
51
|
|
|
$this->roleRequirements = $roleRequirements; |
|
|
|
|
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @return Identity |
56
|
|
|
*/ |
57
|
|
|
public function getActorIdentity() |
58
|
|
|
{ |
59
|
|
|
return $this->actorId; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @return Institution |
64
|
|
|
*/ |
65
|
|
|
public function getActorInstitution() |
66
|
|
|
{ |
67
|
|
|
return $this->actorInstitution; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @return InstitutionRoleSet |
72
|
|
|
*/ |
73
|
|
|
public function getRoleRequirements() |
74
|
|
|
{ |
75
|
|
|
return $this->roleRequirements; |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..