Skip to content

Commit

Permalink
Check if the user's has the CREATE ACL to upload a file
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Jan 31, 2014
1 parent bc1e936 commit 6ad675d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 11 additions & 1 deletion Controller/MediaAdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private function getTemplate($name)
/**
* Returns the response object associated with the browser action
*
* @return @return \Symfony\Bundle\FrameworkBundle\Controller\Response
* @return \Symfony\Component\HttpFoundation\Response
* @throws AccessDeniedException
*/
public function browserAction()
Expand Down Expand Up @@ -74,8 +74,18 @@ public function browserAction()
));
}

/**
* Returns the response object associated with the upload action
*
* @return \Symfony\Component\HttpFoundation\Response
* @throws AccessDeniedException
*/
public function uploadAction()
{
if (false === $this->admin->isGranted('CREATE')) {
throw new AccessDeniedException();
}

$mediaManager = $this->get('sonata.media.manager.media');

$request = $this->getRequest();
Expand Down
1 change: 0 additions & 1 deletion Tests/tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/


if (file_exists($file = __DIR__.'/autoload.php')) {
require_once $file;
} elseif (file_exists($file = __DIR__.'/autoload.php.dist')) {
Expand Down

0 comments on commit 6ad675d

Please sign in to comment.