@@ -3,10 +3,10 @@ |
||
| 3 | 3 | namespace Vivait\AuthBundle\Controller; |
| 4 | 4 | |
| 5 | 5 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
| 6 | -use Symfony\Component\Security\Core\SecurityContext; |
|
| 6 | +use Symfony\Component\Form\FormError; |
|
| 7 | 7 | use Symfony\Component\HttpFoundation\Request; |
| 8 | 8 | use Symfony\Component\HttpFoundation\Response; |
| 9 | -use Symfony\Component\Form\FormError; |
|
| 9 | +use Symfony\Component\Security\Core\SecurityContext; |
|
| 10 | 10 | use Vivait\AuthBundle\Entity\User; |
| 11 | 11 | |
| 12 | 12 | class AuthController extends Controller { |
@@ -3,10 +3,8 @@ |
||
| 3 | 3 | namespace Vivait\AuthBundle\Controller; |
| 4 | 4 | |
| 5 | 5 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
| 6 | -use Symfony\Component\HttpFoundation\Response; |
|
| 7 | 6 | use Symfony\Component\HttpFoundation\Request; |
| 8 | 7 | use Vivait\AuthBundle\Entity\Group; |
| 9 | -use Doctrine\ORM\Query; |
|
| 10 | 8 | |
| 11 | 9 | class GroupController extends Controller |
| 12 | 10 | { |
@@ -2,11 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Vivait\AuthBundle\Controller; |
| 4 | 4 | |
| 5 | - use Doctrine\ORM\EntityRepository; |
|
| 6 | 5 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
| 7 | 6 | use Symfony\Component\HttpFoundation\Request; |
| 8 | - use Doctrine\ORM\Query; |
|
| 9 | - use Vivait\AuthBundle\Entity\User; |
|
| 7 | + use Vivait\AuthBundle\Entity\User; |
|
| 10 | 8 | |
| 11 | 9 | class UserController extends Controller { |
| 12 | 10 | |
@@ -130,6 +130,8 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | 132 | * Constructor |
| 133 | + * @param string $code |
|
| 134 | + * @param string $tenant |
|
| 133 | 135 | */ |
| 134 | 136 | public function __construct( $code = null, $tenant = null, $licensed_until = null ) { |
| 135 | 137 | $this->users = new ArrayCollection(); |
@@ -167,7 +169,7 @@ discard block |
||
| 167 | 169 | |
| 168 | 170 | /** |
| 169 | 171 | * Get users |
| 170 | - * @return ArrayCollection|User[] |
|
| 172 | + * @return ArrayCollection |
|
| 171 | 173 | */ |
| 172 | 174 | public function getUsers() { |
| 173 | 175 | return $this->users; |
@@ -4,10 +4,10 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Doctrine\Common\Collections\ArrayCollection; |
| 6 | 6 | use Doctrine\ORM\Mapping as ORM; |
| 7 | -use Symfony\Component\Validator\Constraints as Assert; |
|
| 8 | -use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; |
|
| 9 | 7 | use Gedmo\Mapping\Annotation as Gedmo; |
| 10 | 8 | use JMS\Serializer\Annotation as Serializer; |
| 9 | +use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; |
|
| 10 | +use Symfony\Component\Validator\Constraints as Assert; |
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * Tenant |
@@ -1,12 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Vivait\AuthBundle\Entity; |
| 3 | 3 | |
| 4 | -use Symfony\Component\Security\Core\User\UserInterface; |
|
| 5 | -use Symfony\Component\Security\Core\User\UserProviderInterface; |
|
| 6 | -use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; |
|
| 7 | -use Symfony\Component\Security\Core\Exception\UnsupportedUserException; |
|
| 8 | 4 | use Doctrine\ORM\EntityRepository; |
| 9 | -use Doctrine\ORM\NoResultException; |
|
| 10 | 5 | |
| 11 | 6 | class TenantRepository extends EntityRepository { |
| 12 | 7 | private $default_tenant; |
@@ -607,7 +607,7 @@ |
||
| 607 | 607 | |
| 608 | 608 | /** |
| 609 | 609 | * Get tenants |
| 610 | - * @return Tenant[]|ArrayCollection |
|
| 610 | + * @return ArrayCollection |
|
| 611 | 611 | */ |
| 612 | 612 | public function getTenants() { |
| 613 | 613 | return $this->tenants; |
@@ -2,14 +2,14 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Vivait\AuthBundle\Entity; |
| 4 | 4 | |
| 5 | -use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; |
|
| 6 | -use Symfony\Component\Security\Core\User\AdvancedUserInterface; |
|
| 5 | +use Doctrine\Common\Collections\ArrayCollection; |
|
| 7 | 6 | use Doctrine\ORM\Mapping as ORM; |
| 7 | +use JMS\Serializer\Annotation as Serializer; |
|
| 8 | 8 | use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; |
| 9 | +use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; |
|
| 10 | +use Symfony\Component\Security\Core\User\AdvancedUserInterface; |
|
| 9 | 11 | use Symfony\Component\Validator\Constraints as Assert; |
| 10 | -use Doctrine\Common\Collections\ArrayCollection; |
|
| 11 | 12 | use Vivait\Common\Model\Footprint\UserInterface as FootprintUserInterface; |
| 12 | -use JMS\Serializer\Annotation as Serializer; |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * @ORM\Entity |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Vivait\AuthBundle\Entity; |
| 3 | 3 | |
| 4 | -use Symfony\Component\Security\Core\User\UserInterface; |
|
| 5 | -use Symfony\Component\Security\Core\User\UserProviderInterface; |
|
| 6 | -use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; |
|
| 7 | -use Symfony\Component\Security\Core\Exception\UnsupportedUserException; |
|
| 8 | 4 | use Doctrine\ORM\EntityRepository; |
| 9 | 5 | use Doctrine\ORM\NoResultException; |
| 6 | +use Symfony\Component\Security\Core\Exception\UnsupportedUserException; |
|
| 7 | +use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; |
|
| 8 | +use Symfony\Component\Security\Core\User\UserInterface; |
|
| 9 | +use Symfony\Component\Security\Core\User\UserProviderInterface; |
|
| 10 | 10 | |
| 11 | 11 | class UserRepository extends EntityRepository implements UserProviderInterface { |
| 12 | 12 | public function loadUserByUsername($username) { |
@@ -85,12 +85,18 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | + /** |
|
| 89 | + * @return Tenant |
|
| 90 | + */ |
|
| 88 | 91 | protected function getDefaultTenant() { |
| 89 | 92 | return $this->tenant_repository->findOneBy(array(), array( |
| 90 | 93 | 'priority' => 'ASC' |
| 91 | 94 | )); |
| 92 | 95 | } |
| 93 | 96 | |
| 97 | + /** |
|
| 98 | + * @return Tenant |
|
| 99 | + */ |
|
| 94 | 100 | protected function getRequestTenant(Request $request) { |
| 95 | 101 | $session = $request->getSession(); |
| 96 | 102 | $tenant_id = $request->get('_tenant'); |
@@ -140,7 +146,7 @@ discard block |
||
| 140 | 146 | |
| 141 | 147 | /** |
| 142 | 148 | * Sets tenant |
| 143 | - * @param mixed $tenant |
|
| 149 | + * @param Tenant $tenant |
|
| 144 | 150 | * @return $this |
| 145 | 151 | */ |
| 146 | 152 | public function setTenant(Tenant $tenant) { |
@@ -3,11 +3,10 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Doctrine\ORM\EntityRepository; |
| 5 | 5 | use Symfony\Bridge\Monolog\Logger; |
| 6 | +use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
|
| 6 | 7 | use Symfony\Component\HttpFoundation\Request; |
| 7 | 8 | use Symfony\Component\HttpKernel\Event\GetResponseEvent; |
| 8 | 9 | use Symfony\Component\HttpKernel\KernelEvents; |
| 9 | -use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
|
| 10 | -use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; |
|
| 11 | 10 | use Symfony\Component\Security\Core\SecurityContext; |
| 12 | 11 | use Vivait\AuthBundle\Entity\Tenant; |
| 13 | 12 | use Vivait\AuthBundle\Entity\TenantRepository; |
@@ -3,14 +3,14 @@ |
||
| 3 | 3 | namespace Vivait\AuthBundle\Features\Context; |
| 4 | 4 | |
| 5 | 5 | use Behat\Behat\Context\BehatContext; |
| 6 | +use Behat\Behat\Context\Step; |
|
| 6 | 7 | use Behat\Gherkin\Node\TableNode; |
| 8 | +use Behat\Symfony2Extension\Context\KernelDictionary; |
|
| 7 | 9 | use Doctrine\Common\Persistence\ObjectManager; |
| 8 | 10 | use Doctrine\ORM\EntityRepository; |
| 9 | 11 | use Vivait\AuthBundle\Entity\Tenant; |
| 10 | 12 | use Vivait\AuthBundle\Entity\User; |
| 11 | 13 | use Vivait\AuthBundle\Entity\UserRepository; |
| 12 | -use Behat\Symfony2Extension\Context\KernelDictionary; |
|
| 13 | -use Behat\Behat\Context\Step; |
|
| 14 | 14 | use Vivait\BehatAliceLoader\AliceContext; |
| 15 | 15 | |
| 16 | 16 | class AuthContext extends BehatContext { |