function tenant_login_login($eventData) { $container = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer'); $username = $eventData['username']; // Handle the case when the root user tries to login from the tenant login form if (strcmp($username, 'root') === 0) { require_once 'innomatic/desktop/auth/DesktopRootAuthenticatorHelper.php'; \Innomatic\Desktop\Auth\root_login_login($eventData); $response = \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getResponse(); $response->sendRedirect($container->getBaseUrl(false) . '/root/'); $response->flushBuffer(); return; } $domainId = \Innomatic\Domain\User\User::extractDomainID($username); // Checks it it can find the domain by hostname if (!strlen($domainId)) { $domainId = \Innomatic\Domain\Domain::getDomainByHostname(); if (strlen($domainId)) { $username .= '@' . $domainId; } } // If no domain is found when in Multi Tenant edition, it must be reauth without // checking database, since no Domain can be accessed. if (!strlen($domainId)) { DesktopDomainAuthenticatorHelper::doAuth(true); } $tmpDomain = new \Innomatic\Domain\Domain($container->getDataAccess(), $domainId, null); $domainDA = $tmpDomain->getDataAccess(); $userQuery = $domainDA->execute('SELECT * FROM domain_users WHERE username='******' AND password='******'password']))); // Check if the user/password couple exists if ($userQuery->getNumberRows()) { // Check if the user is not disabled if ($userQuery->getFields('disabled') == $container->getDataAccess()->fmttrue) { DesktopDomainAuthenticatorHelper::doAuth(true, 'userdisabled'); } else { // Login ok, set the session key \Innomatic\Desktop\Controller\DesktopFrontController::instance('\\Innomatic\\Desktop\\Controller\\DesktopFrontController')->session->put('INNOMATIC_AUTH_USER', $username); $innomaticSecurity = new \Innomatic\Security\SecurityManager(); $innomaticSecurity->logAccess($username, false, false, $_SERVER['REMOTE_ADDR']); unset($innomaticSecurity); } } else { DesktopDomainAuthenticatorHelper::doAuth(true); } // unset( $INNOMATIC_ROOT_AUTH_USER ); }
/** * Disables the component to the given domain. * * @param string $domainid Identifier name of the domain * @param array $params Parameters in the component definition * @access public * @return bool True when the component has been successfully disabled from the domain */ public function disable($domainid, $params) { $result = false; $override = self::OVERRIDE_NONE; if (isset($params['override'])) { switch ($params['override']) { case self::OVERRIDE_DOMAIN: case self::OVERRIDE_GLOBAL: $override = $params['override']; break; } } if ($this->getIsDomain() or isset($params['override']) and $params['override'] == self::OVERRIDE_DOMAIN) { if ($this->applicationsComponentsRegister->checkRegisterComponent($this->getType(), $this->name, $domainid, $this->appname, $override) != false) { if ($this->applicationsComponentsRegister->checkRegisterComponent($this->getType(), $this->name, $domainid, $this->appname, $override, true) == false) { if (strlen($domainid)) { // Start domain $this->container->startDomain(\Innomatic\Domain\Domain::getTenantNameById($domainid)); // Set the domain dataaccess for the component $this->domainda = $this->container->getCurrentDomain()->getDataAccess(); } $result = $this->doDisableDomainAction($domainid, $params); $this->applicationsComponentsRegister->unregisterComponent($this->appname, $this->getType(), $this->name, $domainid, $override); if (strlen($domainid)) { // Stop domain $this->container->stopDomain(); } } else { $result = $this->applicationsComponentsRegister->unregisterComponent($this->appname, $this->getType(), $this->name, $domainid, $override); } } } else { $result = true; } return $result; }
function login_login($eventData) { $container = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer'); $username = $eventData['username']; $domainId = \Innomatic\Domain\User\User::extractDomainID($username); // Checks it it can find the domain by hostname if (!strlen($domainId)) { $domainId = \Innomatic\Domain\Domain::getDomainByHostname(); if (strlen($domainId)) { $username .= '@' . $domainId; } } // If no domain is found when in Multi Tenant edition, it must be reauth without // checking database, since no Domain can be accessed. if (!strlen($domainId)) { DesktopDomainAuthenticatorHelper::doAuth(true); } $tmpDomain = new \Innomatic\Domain\Domain($container->getDataAccess(), $domainId, null); $domainDA = $tmpDomain->getDataAccess(); $userQuery = $domainDA->execute('SELECT * FROM domain_users WHERE username='******' AND password='******'password']))); // Check if the user/password couple exists if ($userQuery->getNumberRows()) { // Check if the user is not disabled if ($userQuery->getFields('disabled') == $container->getDataAccess()->fmttrue) { DesktopDomainAuthenticatorHelper::doAuth(true, 'userdisabled'); } else { // Login ok, set the session key \Innomatic\Desktop\Controller\DesktopFrontController::instance('\\Innomatic\\Desktop\\Controller\\DesktopFrontController')->session->put('INNOMATIC_AUTH_USER', $username); $innomaticSecurity = new \Innomatic\Security\SecurityManager(); $innomaticSecurity->logAccess($username, false, false, $_SERVER['REMOTE_ADDR']); unset($innomaticSecurity); } } else { DesktopDomainAuthenticatorHelper::doAuth(true); } // unset( $INNOMATIC_ROOT_AUTH_USER ); }