Browse Source

Fix deletion of packages by maintainers

Jordi Boggiano 12 years ago
parent
commit
b8f8cda55d
1 changed files with 3 additions and 5 deletions
  1. 3 5
      src/Packagist/WebBundle/Controller/WebController.php

+ 3 - 5
src/Packagist/WebBundle/Controller/WebController.php

@@ -424,10 +424,6 @@ class WebController extends Controller
      */
     public function deletePackageAction(Request $req, $name)
     {
-        if (!$this->get('security.context')->isGranted('ROLE_DELETE_PACKAGES')) {
-            throw new AccessDeniedException;
-        }
-
         $doctrine = $this->getDoctrine();
 
         try {
@@ -438,7 +434,9 @@ class WebController extends Controller
             throw new NotFoundHttpException('The requested package, '.$name.', was not found.');
         }
 
-        $form = $this->createDeletePackageForm($package);
+        if (!$form = $this->createDeletePackageForm($package)) {
+            throw new AccessDeniedException;
+        }
         $form->bind($req->request->get('form'));
         if ($form->isValid()) {
             $versionRepo = $doctrine->getRepository('PackagistWebBundle:Version');