security->isGranted(StoredObjectRoleEnum::EDIT->value, $storedObjectVersion->getStoredObject())) { throw new AccessDeniedHttpException('not allowed to edit the stored object'); } $newVersion = $this->storedObjectRestore->restore($storedObjectVersion); $this->entityManager->persist($newVersion); $this->entityManager->flush(); return new JsonResponse( $this->serializer->serialize($newVersion, 'json', [AbstractNormalizer::GROUPS => ['read', StoredObjectVersionNormalizer::WITH_POINT_IN_TIMES_CONTEXT]]), json: true ); } }