/** * @param string $username * @param string $userpassword * * @return boolean * @throws \Cms\Exception (auch bei fehlerhafter Anmeldung) */ public function checkFtpLogin($username, $userpassword) { $accessManager = AccessManager::singleton(); $autResult = $accessManager->checkLogin($username, $userpassword); if (!$accessManager->isAuthResultValid($autResult)) { throw new \Cms\Exception(2006, __METHOD__, __LINE__); } // only superusers are allowed to login via FTP $identity = $autResult->getIdentity(); if (!is_array($identity) || !isset($identity['superuser']) || $identity['superuser'] != true) { throw new \Cms\Exception(2007, __METHOD__, __LINE__); } // module development must be enabled to login via FTP $quota = new Quota(); if (!$quota->getModuleQuota()->getEnableDev()) { throw new \Cms\Exception(2007, __METHOD__, __LINE__); } return true; }
/** * @test * * @group quota * @group small * @group dev */ public function test_getDefaultModuleQuotaSuccess() { // ARRANGE $expectedEnableDev = false; ConfigHelper::removeValue(array('quota')); // ACT $quota = new Quota(); $actualModuleQuota = $quota->getModuleQuota(); // ASSERT $actualEnableDev = $actualModuleQuota->getEnableDev(); $this->assertEquals($expectedEnableDev, $actualEnableDev); }
/** * Checks if the module developments is allowed. Throws Exception if not! * * @throws \Cms\Exception */ public function checkModuleDevelopmentQuota() { $quota = new Quota(); $moduleQuota = $quota->getModuleQuota(); if (!$moduleQuota->getEnableDev()) { throw new CmsException(2301, __METHOD__, __LINE__); } }