| @@ 48-66 (lines=19) @@ | ||
| 45 | $this->logger = $logger; |
|
| 46 | } |
|
| 47 | ||
| 48 | public function amendRegistrationAuthorityInformation(AmendRegistrationAuthorityInformationCommand $command) |
|
| 49 | { |
|
| 50 | $apiCommand = new AmendRegistrationAuthorityInformationApiCommand(); |
|
| 51 | $apiCommand->identityId = $command->identityId; |
|
| 52 | $apiCommand->location = $command->location; |
|
| 53 | $apiCommand->contactInformation = $command->contactInformation; |
|
| 54 | ||
| 55 | $result = $this->commandService->execute($apiCommand); |
|
| 56 | ||
| 57 | if (!$result->isSuccessful()) { |
|
| 58 | $this->logger->error(sprintf( |
|
| 59 | "Amending of registration authority %s's information failed: '%s'", |
|
| 60 | $apiCommand->identityId, |
|
| 61 | implode("', '", $result->getErrors()) |
|
| 62 | )); |
|
| 63 | } |
|
| 64 | ||
| 65 | return $result->isSuccessful(); |
|
| 66 | } |
|
| 67 | ||
| 68 | public function changeRegistrationAuthorityRole(ChangeRaRoleCommand $command) |
|
| 69 | { |
|
| @@ 68-86 (lines=19) @@ | ||
| 65 | return $result->isSuccessful(); |
|
| 66 | } |
|
| 67 | ||
| 68 | public function changeRegistrationAuthorityRole(ChangeRaRoleCommand $command) |
|
| 69 | { |
|
| 70 | $apiCommand = new AppointRoleCommand(); |
|
| 71 | $apiCommand->identityId = $command->identityId; |
|
| 72 | $apiCommand->role = $command->role; |
|
| 73 | ||
| 74 | $result = $this->commandService->execute($apiCommand); |
|
| 75 | ||
| 76 | if (!$result->isSuccessful()) { |
|
| 77 | $this->logger->error(sprintf( |
|
| 78 | 'Could not change Identity "%s" role to "%s": "%s"', |
|
| 79 | $apiCommand->identityId, |
|
| 80 | $apiCommand->role, |
|
| 81 | implode("', '", $result->getErrors()) |
|
| 82 | )); |
|
| 83 | } |
|
| 84 | ||
| 85 | return $result->isSuccessful(); |
|
| 86 | } |
|
| 87 | ||
| 88 | public function retractRegistrationAuthority(RetractRegistrationAuthorityCommand $command) |
|
| 89 | { |
|
| @@ 141-159 (lines=19) @@ | ||
| 138 | * @param RemoveRaLocationCommand $command |
|
| 139 | * @return bool |
|
| 140 | */ |
|
| 141 | public function remove(RemoveRaLocationCommand $command) |
|
| 142 | { |
|
| 143 | $middlewareCommand = new MiddlewareRemoveRaLocationCommand(); |
|
| 144 | $middlewareCommand->institution = $command->institution; |
|
| 145 | $middlewareCommand->raLocationId = $command->locationId; |
|
| 146 | $result = $this->commandService->execute($middlewareCommand); |
|
| 147 | ||
| 148 | if (!$result->isSuccessful()) { |
|
| 149 | $this->logger->critical(sprintf( |
|
| 150 | 'Removal of RA location "%s" of institution "%s" by user "%s" failed: "%s"', |
|
| 151 | $middlewareCommand->raLocationId, |
|
| 152 | $middlewareCommand->institution, |
|
| 153 | $command->currentUserId, |
|
| 154 | implode(", ", $result->getErrors()) |
|
| 155 | )); |
|
| 156 | } |
|
| 157 | ||
| 158 | return $result->isSuccessful(); |
|
| 159 | } |
|
| 160 | } |
|
| 161 | ||