diff --git a/academic-id/slim-app/composer.lock b/academic-id/slim-app/composer.lock index 3d0919bdba3fb2afba52d8b6c9cf58af6acdb717..1b597caa3a9184ecb26f20128d37a7d42df21a65 100644 --- a/academic-id/slim-app/composer.lock +++ b/academic-id/slim-app/composer.lock @@ -9,18 +9,21 @@ "packages": [ { "name": "container-interop/container-interop", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/container-interop/container-interop.git", - "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e" + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/container-interop/container-interop/zipball/fc08354828f8fd3245f77a66b9e23a6bca48297e", - "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e", + "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8", "shasum": "" }, + "require": { + "psr/container": "^1.0" + }, "type": "library", "autoload": { "psr-4": { @@ -32,7 +35,8 @@ "MIT" ], "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", - "time": "2014-12-30 15:22:37" + "homepage": "https://github.com/container-interop/container-interop", + "time": "2017-02-14 19:40:03" }, { "name": "monolog/monolog", @@ -201,6 +205,55 @@ ], "time": "2015-09-11 15:10:35" }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14 16:28:37" + }, { "name": "psr/http-message", "version": "1.0.1", @@ -970,16 +1023,16 @@ }, { "name": "phpunit/phpunit", - "version": "5.7.12", + "version": "5.7.14", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "944600e244f80a5252679878553b95c63dbf978b" + "reference": "4906b8faf23e42612182fd212eb6f4c0f2954b57" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/944600e244f80a5252679878553b95c63dbf978b", - "reference": "944600e244f80a5252679878553b95c63dbf978b", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4906b8faf23e42612182fd212eb6f4c0f2954b57", + "reference": "4906b8faf23e42612182fd212eb6f4c0f2954b57", "shasum": "" }, "require": { @@ -1003,7 +1056,7 @@ "sebastian/global-state": "^1.1", "sebastian/object-enumerator": "~2.0", "sebastian/resource-operations": "~1.0", - "sebastian/version": "~1.0|~2.0", + "sebastian/version": "~1.0.3|~2.0", "symfony/yaml": "~2.1|~3.0" }, "conflict": { @@ -1048,7 +1101,7 @@ "testing", "xunit" ], - "time": "2017-02-08 05:54:05" + "time": "2017-02-19 07:22:16" }, { "name": "phpunit/phpunit-mock-objects", @@ -1440,16 +1493,16 @@ }, { "name": "sebastian/object-enumerator", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35" + "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35", - "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", + "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", "shasum": "" }, "require": { @@ -1482,7 +1535,7 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2016-11-19 07:35:10" + "time": "2017-02-18 15:18:39" }, { "name": "sebastian/recursion-context", @@ -1624,16 +1677,16 @@ }, { "name": "symfony/yaml", - "version": "v3.2.3", + "version": "v3.2.4", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "e1718c6bf57e1efbb8793ada951584b2ab27775b" + "reference": "9724c684646fcb5387d579b4bfaa63ee0b0c64c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/e1718c6bf57e1efbb8793ada951584b2ab27775b", - "reference": "e1718c6bf57e1efbb8793ada951584b2ab27775b", + "url": "https://api.github.com/repos/symfony/yaml/zipball/9724c684646fcb5387d579b4bfaa63ee0b0c64c8", + "reference": "9724c684646fcb5387d579b4bfaa63ee0b0c64c8", "shasum": "" }, "require": { @@ -1675,7 +1728,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-01-21 17:06:35" + "time": "2017-02-16 22:46:52" }, { "name": "webmozart/assert", diff --git a/academic-id/slim-app/src/middleware.php b/academic-id/slim-app/src/middleware.php index 40cd22869092e321106d0b34cec43812880a3564..e128052b35230bed585907baf1d110e5b2a61847 100644 --- a/academic-id/slim-app/src/middleware.php +++ b/academic-id/slim-app/src/middleware.php @@ -4,10 +4,8 @@ $settings = $app->getContainer()->get('settings'); $username = isset($settings['app']['secure_endpoint_username']) ? $settings['app']['secure_endpoint_username'] : ''; $password = isset($settings['app']['secure_endpoint_password']) ? $settings['app']['secure_endpoint_password'] : ''; -$app->getContainer()->get('router') - ->getNamedRoute('queryID') - ->add(new Gr\Gov\Minedu\Osteam\Slim\AuthorizationGuard($username, $password)); - -$app->getContainer()->get('router') - ->getNamedRoute('student') - ->add(new Gr\Gov\Minedu\Osteam\Slim\AuthorizationGuard($username, $password)); +foreach (['queryID', 'queryIDnoCD', 'student', 'testServiceStatusp', 'testServiceStatusq'] as $r) { + $app->getContainer()->get('router') + ->getNamedRoute($r) + ->add(new Gr\Gov\Minedu\Osteam\Slim\AuthorizationGuard($username, $password)); +} diff --git a/academic-id/slim-app/src/osteam/App.php b/academic-id/slim-app/src/osteam/App.php index 99872293dc708c1cd1dad838162c7f5dda0a83f5..d1d533de04aff4fac0d43a0bb30b1dc9e5a1a252 100644 --- a/academic-id/slim-app/src/osteam/App.php +++ b/academic-id/slim-app/src/osteam/App.php @@ -185,10 +185,10 @@ class App extends BaseApp if ($parsed_result['response'] === 'SUCCESS' && $parsed_result['errorReason'] === null) { if (isset($parsed_result['inspectionResult']) && $parsed_result['inspectionResult']['webServiceSuccess'] === true) { - return $this->withTextReady($res, 'true'); + return $this->withTextReady($res, 'isStudent:true'); } } - return $this->withTextReady($res, 'false'); + return $this->withTextReady($res, 'isStudent:false'); } /** @@ -242,4 +242,28 @@ class App extends BaseApp return $this->withTextReady($res, 'false'); } + + /** + * + * @param Psr\Http\Message\ServerRequestInterface $req + * @param Psr\Http\Message\ResponseInterface $res + * @param $args + * @throws \Exception + * @return Response + */ + public function testServiceStatus($req, $res, $args) + { + $identity = $req->getQueryParam('id', null); + if ($identity === null) { + if (isset($args['identity'])) { + $identity = $args['identity']; + } else { + $identity = ''; + } + } + + $this->logger->info("testServiceStatus::{$identity}"); + + return $this->withTextReady($res, "Student ID sent was: {$identity}"); + } } diff --git a/academic-id/slim-app/src/osteam/BaseApp.php b/academic-id/slim-app/src/osteam/BaseApp.php index 2ca99f89a2715d2eaf3a39f6acce5584391dda38..015c8530ec8a9e4ea15071e3f9b7e1fa25b01dd6 100644 --- a/academic-id/slim-app/src/osteam/BaseApp.php +++ b/academic-id/slim-app/src/osteam/BaseApp.php @@ -47,6 +47,7 @@ class BaseApp return [ // 'success' => $success === true, // 'timestamp' => date('c') + // 'client' => 'php ' . getHostByName(getHostName()) ]; } diff --git a/academic-id/slim-app/src/routes.php b/academic-id/slim-app/src/routes.php index 3ae4f67b88f515f7a19758553516da2e94a9ab3e..0cdb038f62fa90553529087145dfd16b04af3b60 100644 --- a/academic-id/slim-app/src/routes.php +++ b/academic-id/slim-app/src/routes.php @@ -9,6 +9,12 @@ $app->get('/queryIDnoCD', '\Gr\Gov\Minedu\Osteam\Slim\App:queryIDnoCD') $app->get('/student/{identity}', '\Gr\Gov\Minedu\Osteam\Slim\App:student') ->setName('student'); +$app->get('/testServiceStatus/[{identity}]', '\Gr\Gov\Minedu\Osteam\Slim\App:testServiceStatus') + ->setName('testServiceStatusp'); + +$app->get('/testServiceStatus', '\Gr\Gov\Minedu\Osteam\Slim\App:testServiceStatus') + ->setName('testServiceStatusq'); + $app->any('/[{anythingelse}]', function ($request, $response, $args) { $this->logger->info("Void response, no action route was enabled"); return $response->withJson([