throw 403 error instead of 422 and display toast message

This commit is contained in:
2022-02-25 13:11:30 +01:00
parent 68bfca8a1f
commit 16cca07e12
7 changed files with 17 additions and 44 deletions

View File

@@ -332,11 +332,6 @@ final class AccompanyingCourseApiController extends ApiController
$accompanyingCourse->setConfidential(!$accompanyingCourse->isConfidential());
$errors = $this->validator->validate($accompanyingCourse);
if ($errors->count() > 0) {
return $this->json($errors, 422);
}
$this->getDoctrine()->getManager()->flush();
}
@@ -349,6 +344,7 @@ final class AccompanyingCourseApiController extends ApiController
*/
public function toggleIntensityApi(AccompanyingPeriod $accompanyingCourse, Request $request)
{
if ($request->getMethod() === 'POST') {
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::TOGGLE_INTENSITY, $accompanyingCourse);