mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
confidential toggle rights
This commit is contained in:
@@ -249,6 +249,22 @@ final class AccompanyingCourseApiController extends ApiController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/api/1.0/person/accompanying-course/{id}/confidential.json", name="chill_api_person_accompanying_period_confidential")
|
||||
* @ParamConverter("accompanyingCourse", options={"id": "id"})
|
||||
*/
|
||||
public function toggleConfidentialApi(AccompanyingPeriod $accompanyingCourse, Request $request)
|
||||
{
|
||||
if ($request->getMethod() === 'POST') {
|
||||
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::CONFIDENTIAL, $accompanyingCourse);
|
||||
|
||||
$accompanyingCourse->setConfidential(!$accompanyingCourse->isConfidential());
|
||||
$this->getDoctrine()->getManager()->flush();
|
||||
}
|
||||
|
||||
return $this->json($accompanyingCourse->isConfidential(), Response::HTTP_OK, [], ['groups' => ['read']]);
|
||||
}
|
||||
|
||||
public function workApi($id, Request $request, string $_format): Response
|
||||
{
|
||||
return $this->addRemoveSomething(
|
||||
|
Reference in New Issue
Block a user