Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function resolve($host = null)
 {
     // fallback to default tenant
     if (null === $host) {
         $host = self::DEFAULT_TENANT;
     }
     $subdomain = $this->extractSubdomain($host);
     return $this->tenantRepository->findBySubdomain($subdomain);
 }
 public function checkCredentials($credentials, UserInterface $user)
 {
     if ($user instanceof User) {
         $currentTenantOrganization = $this->tenantContext->getTenant()->getOrganization();
         $userTenantOrganization = $this->tenantRepository->findOneByCode($user->getTenantCode());
         if ($currentTenantOrganization->getId() === $userTenantOrganization->getId()) {
             return true;
         }
     }
     return false;
 }
 /**
  * {@inheritdoc}
  */
 public function resolve($host = null)
 {
     if (null === $host) {
         $host = self::DEFAULT_TENANT;
     }
     $subdomain = $this->extractSubdomain($host);
     $tenant = $this->tenantRepository->findOneBySubdomain($subdomain);
     if (null === $tenant) {
         throw new TenantNotFoundException($subdomain);
     }
     return $tenant;
 }
Esempio n. 4
0
 /**
  * {@inheritdoc}
  */
 public function getAvailableTenants()
 {
     return $this->tenantRepository->findAvailableTenants();
 }