Skip to content

Commit

Permalink
CS-5604: Journalist role can manage plugins by default
Browse files Browse the repository at this point in the history
Check if user have access to plugins manager.
  • Loading branch information
Paweł Mikołajczuk committed Jan 13, 2015
1 parent 8731840 commit d947689
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
Expand All @@ -26,8 +27,13 @@ class PluginsController extends Controller
*/
public function indexAction(Request $request)
{
$user = $this->container->get('user')->getCurrentUser();
$translator = $this->container->get('translator');
if (!$user->hasPermission('plugin_manager')) {
throw new AccessDeniedException($translator->trans("You do not have the right to manage plugins.", array(), 'plugins'));
}

$pluginService = $this->container->get('newscoop.plugins.service');
$translator = $this->get('translator');
$allAvailablePlugins = array();

// show only modern plugins
Expand Down

0 comments on commit d947689

Please sign in to comment.