Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
43 | public function switchDomain(User $user, Domain $newDomain): void |
||
44 | { |
||
45 | $mapToId = function(DataObject $object) { |
||
46 | return $object->getId(); |
||
47 | }; |
||
48 | |||
49 | $allowed = in_array($newDomain->getId(), array_map($mapToId, self::getAllowedDomains($user))); |
||
|
|||
50 | |||
51 | if ($allowed) { |
||
52 | WebRequest::setActiveDomain($newDomain); |
||
53 | } |
||
54 | else { |
||
55 | throw new AccessDeniedException($this->securityManager, $this); |
||
56 | } |
||
58 | } |