Skip to content

Commit

Permalink
CS-5678: create default oauth client - update editorial comments to u…
Browse files Browse the repository at this point in the history
…se new default client
  • Loading branch information
ahilles107 committed Feb 24, 2015
1 parent 5baefe0 commit 944af82
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,8 @@ public function __construct(EntityManager $em, EngineInterface $templating, $cli
public function renderEditorialCommentsTemplate(PluginHooksEvent $event)
{
$article = $event->getArgument('article');
$client = $this->em->getRepository('\Newscoop\GimmeBundle\Entity\Client')->findOneByName('editorial_comments_'.$this->preferencesService->SiteSecretKey);

if (!$client) {
$client = $this->createAPIClient();
}
$clientName = 'newscoop_'.$this->preferencesService->SiteSecretKey;
$client = $this->em->getRepository('\Newscoop\GimmeBundle\Entity\Client')->findOneByName($clientName);

$response = $this->templating->renderResponse('NewscoopArticlesBundle:Hook:editorialComments.html.twig', array(
'article' => $article,
Expand All @@ -61,18 +58,4 @@ public function renderEditorialCommentsTemplate(PluginHooksEvent $event)

return true;
}

private function createAPIClient()
{
$publication = $this->publicationService->getPublication();
$client = $this->clientManager->createClient();
$client->setName('editorial_comments_'.$this->preferencesService->SiteSecretKey);
$client->setPublication($publication);
$client->setRedirectUris(array($publication->getDefaultAlias()->getName()));
$client->setAllowedGrantTypes(array('authorization_code'));
$client->setTrusted(true);
$this->clientManager->updateClient($client);

return $client;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
class SecurityController extends Controller
{
/**
* TODO:
* * demo login
*
* @Template()
*/
public function loginAction(Request $request)
Expand Down

0 comments on commit 944af82

Please sign in to comment.