From 6338ad4475a5c8c6bb37cc36026f2b5d67c62aaf Mon Sep 17 00:00:00 2001 From: Taras Machyshyn Date: Wed, 26 Feb 2014 10:30:33 +0200 Subject: [PATCH] deleting unnecessary files --- application/.htaccess | 2 + cli-config.php | 7 ---- testAuth.php | 96 ------------------------------------------- 3 files changed, 2 insertions(+), 103 deletions(-) create mode 100644 application/.htaccess delete mode 100644 cli-config.php delete mode 100644 testAuth.php diff --git a/application/.htaccess b/application/.htaccess new file mode 100644 index 0000000000..2859d7f432 --- /dev/null +++ b/application/.htaccess @@ -0,0 +1,2 @@ +Order Deny,Allow +Deny from all \ No newline at end of file diff --git a/cli-config.php b/cli-config.php deleted file mode 100644 index 5ff814ea08..0000000000 --- a/cli-config.php +++ /dev/null @@ -1,7 +0,0 @@ - new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($base->em) -)); diff --git a/testAuth.php b/testAuth.php deleted file mode 100644 index a4da9ea1e0..0000000000 --- a/testAuth.php +++ /dev/null @@ -1,96 +0,0 @@ -entityManager = $entityManager; - $this->container = $container; - } - - function call() - { - $req = $this->app->request(); - $res = $this->app->response(); - - $uri = $req->getResourceUri(); - $httpMethod = $req->getMethod(); - - /** - * Check if user credentials are required for current route - */ - $routes = $this->app->router()->getMatchedRoutes($httpMethod, $uri); - - if (!empty($routes[0])) { - $routeConditions = $routes[0]->getConditions(); - if (isset($routeConditions['auth']) && $routeConditions['auth'] === false) { - $this->container->setUser($this->entityManager->getRepository('User')); - $this->next->call(); - return; - } - } - - $authKey = $req->headers('PHP_AUTH_USER'); - $authSec = $req->headers('PHP_AUTH_PW'); - - if ($authKey && $authSec) { - - $isAuthenticated = false; - - $username = $authKey; - $password = $authSec; - - $user = $this->entityManager->getRepository('User')->findOne(array( - 'whereClause' => array( - 'userName' => $username, - 'password' => md5($password) - ), - )); - - - if ($user instanceof \Espo\Entities\User) { - $this->entityManager->setUser($user); - $this->container->setUser($user); - $isAuthenticated = true; - } - - //$isAuthenticated = true; - - - if ($isAuthenticated) { - $this->next->call(); - } else { - $res->header('WWW-Authenticate', sprintf('Basic realm="%s"', '')); - $res->status(401); - } - } else { - $res->header('WWW-Authenticate', sprintf('Basic realm="%s"', '')); - $res->status(401); - } - } -} - - -$auth = new Auth($app->getContainer()->get('entityManager'), $app->getContainer()); -$app->getSlim()->add($auth); - - -$app->getSlim()->get('/', function() { - echo <<EspoCRM REST API!!! -EOT; -}); - -$app->getSlim()->run(); - - -?> \ No newline at end of file