| @@ 119-144 (lines=26) @@ | ||
| 116 | * |
|
| 117 | * @return RedirectResponse |
|
| 118 | */ |
|
| 119 | public function activateUserAction( |
|
| 120 | Request $request, |
|
| 121 | GroupDefinitionAwareRollout $rollout, |
|
| 122 | UserProviderInterface $userProvider, |
|
| 123 | string $feature |
|
| 124 | ) { |
|
| 125 | $requestUser = $request->get('user'); |
|
| 126 | $user = $userProvider->findByRolloutIdentifier($requestUser); |
|
| 127 | ||
| 128 | if ($user) { |
|
| 129 | $rollout->activateUser($feature, $user); |
|
| 130 | ||
| 131 | $this->addFlash( |
|
| 132 | 'info', |
|
| 133 | sprintf( |
|
| 134 | "User '%s' was activated in feature '%s'", |
|
| 135 | $user->getRolloutIdentifier(), |
|
| 136 | $feature |
|
| 137 | ) |
|
| 138 | ); |
|
| 139 | } else { |
|
| 140 | $this->addFlash('danger', sprintf("User '%s' not found", $requestUser)); |
|
| 141 | } |
|
| 142 | ||
| 143 | return $this->redirectToRoute('opensoft_rollout'); |
|
| 144 | } |
|
| 145 | ||
| 146 | /** |
|
| 147 | * @param GroupDefinitionAwareRollout $rollout |
|
| @@ 154-178 (lines=25) @@ | ||
| 151 | * |
|
| 152 | * @return RedirectResponse |
|
| 153 | */ |
|
| 154 | public function deactivateUserAction( |
|
| 155 | GroupDefinitionAwareRollout $rollout, |
|
| 156 | UserProviderInterface $userProvider, |
|
| 157 | string $feature, |
|
| 158 | string $id |
|
| 159 | ) { |
|
| 160 | $user = $userProvider->findByRolloutIdentifier($id); |
|
| 161 | ||
| 162 | if ($user) { |
|
| 163 | $rollout->deactivateUser($feature, $user); |
|
| 164 | ||
| 165 | $this->addFlash( |
|
| 166 | 'info', |
|
| 167 | sprintf( |
|
| 168 | "User '%s' was deactivated from feature '%s'", |
|
| 169 | $user->getRolloutIdentifier(), |
|
| 170 | $feature |
|
| 171 | ) |
|
| 172 | ); |
|
| 173 | } else { |
|
| 174 | $this->addFlash('danger', sprintf("User '%s' not found", $id)); |
|
| 175 | } |
|
| 176 | ||
| 177 | return $this->redirectToRoute('opensoft_rollout'); |
|
| 178 | } |
|
| 179 | ||
| 180 | /** |
|
| 181 | * @param GroupDefinitionAwareRollout $rollout |
|