43 lines
1.2 KiB
PHP
43 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Controller\CAPI;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
use Doctrine\ORM\Query;
|
|
use Doctrine\ORM\EntityManagerInterface;
|
|
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
|
|
use Catalyst\ApiBundle\Controller\ApiController;
|
|
use Catalyst\ApiBundle\Component\Response as APIResponse;
|
|
|
|
use App\Entity\PrivacyPolicy;
|
|
|
|
use Catalyst\AuthBundle\Service\ACLGenerator as ACLGenerator;
|
|
|
|
// third party API
|
|
class PrivacyPolicyController extends ApiController
|
|
{
|
|
protected $acl_gen;
|
|
|
|
public function __construct(ACLGenerator $acl_gen)
|
|
{
|
|
$this->acl_gen = $acl_gen;
|
|
}
|
|
|
|
public function getPrivacyPolicy($id, EntityManagerInterface $em)
|
|
{
|
|
$this->denyAccessUnlessGranted('privacypolicy.find', null, 'No access.');
|
|
|
|
$privacy_policy = $em->getRepository(PrivacyPolicy::class)->find($id);
|
|
|
|
if ($privacy_policy == null)
|
|
return new APIResponse(false, 'No privacy policy found with that number.', null, 404);
|
|
|
|
$data = [
|
|
'privacy_policy' => (string) $privacy_policy->getContent(),
|
|
];
|
|
|
|
return new APIResponse(true, 'Privacy policy found.', $data);
|
|
|
|
}
|
|
}
|