xaav 14 жил өмнө
parent
commit
aef60516cc

+ 2 - 1
app/config/security.yml

@@ -36,8 +36,9 @@ security:
         # Secured part of the site
         # This config requires being logged for the whole site and having the admin role for the admin part.
         # Change these rules to adapt them to your needs
+        - { path: ^/submit/, role: ROLE_USER }
+        - { path: ^/submit$, role: ROLE_USER }
         - { path: ^/admin/, role: ROLE_ADMIN }
-        - { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY }
 
     role_hierarchy:
         ROLE_ADMIN:       ROLE_USER

+ 25 - 4
src/Packagist/WebBundle/Entity/Package.php

@@ -50,10 +50,11 @@ class Package
      */
     private $versions;
 
-//    /**
-//     * @ORM\ManyToMany(targetEntity="User")
-//     */
-//    private $maintainers;
+    /**
+     * @ORM\ManyToMany(targetEntity="User", inversedBy="packages")
+     * @ORM\JoinTable(name="maintainers_packages")
+     */
+    private $maintainers;
 
     // dist-tags / rel or runtime?
 
@@ -198,4 +199,24 @@ class Package
     {
         return $this->updatedAt;
     }
+
+    /**
+     * Add maintainers
+     *
+     * @param Packagist\WebBundle\Entity\User $maintainers
+     */
+    public function addMaintainers(\Packagist\WebBundle\Entity\User $maintainers)
+    {
+        $this->maintainers[] = $maintainers;
+    }
+
+    /**
+     * Get maintainers
+     *
+     * @return Doctrine\Common\Collections\Collection $maintainers
+     */
+    public function getMaintainers()
+    {
+        return $this->maintainers;
+    }
 }

+ 40 - 1
src/Packagist/WebBundle/Entity/User.php

@@ -17,4 +17,43 @@ class User extends BaseUser
      * @ORM\generatedValue(strategy="AUTO")
      */
     protected $id;
-}
+
+    /**
+     * @ORM\ManyToMany(targetEntity="Package", mappedBy="maintainers")
+     */
+    private $packages;
+    public function __construct()
+    {
+        $this->packages = new \Doctrine\Common\Collections\ArrayCollection();
+    }
+    
+    /**
+     * Get id
+     *
+     * @return integer $id
+     */
+    public function getId()
+    {
+        return $this->id;
+    }
+
+    /**
+     * Add packages
+     *
+     * @param Packagist\WebBundle\Entity\Package $packages
+     */
+    public function addPackages(\Packagist\WebBundle\Entity\Package $packages)
+    {
+        $this->packages[] = $packages;
+    }
+
+    /**
+     * Get packages
+     *
+     * @return Doctrine\Common\Collections\Collection $packages
+     */
+    public function getPackages()
+    {
+        return $this->packages;
+    }
+}