From c2a5b1880c19c1490c42eb40a6a15ce2bc64b9e9 Mon Sep 17 00:00:00 2001 From: EoleDev Date: Fri, 5 Feb 2016 00:07:31 +0100 Subject: Request Analyse reviewed, Server Initialisation Reviewed, Core Class Interface Created, App created --- server/core/App.php | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 server/core/App.php (limited to 'server/core/App.php') diff --git a/server/core/App.php b/server/core/App.php new file mode 100755 index 0000000..45f6922 --- /dev/null +++ b/server/core/App.php @@ -0,0 +1,68 @@ +tokenPost = NULL; + $this->tokenClass = new genTokenOptions($args); + $this->openstack = new OpenStack\OpenStack([]); + $this->pluginsApi = plugin_api::getInstance(); + $this->output = array(); + + } + + public function setToken($token){ + + $this->tokenPost = $token; + $this->tokenClass->loadBackup($his->tokenPost); + + } + + public function getLibClass($service){ + + switch($service){ + case "Identity": + if($tokenPost == NULL) $tokenClass->genIdentityToken(); + $opt = $tokenClass->getOptions($service); + return $this->openstack->identityV3($opt); + break; + } + + } + + public function authenticate(){ + + try{ + $this->tokenClass->genIdentityToken(); + $this->tokenClass->genComputeToken(); + $this->tokenClass->genImageToken(); + $this->tokenClass->genNetworkToken(); + + $this->setOutput("token", $this->tokenClass->getBackup()); + }catch(Exception $e){ + echo $e; + exit(); + } + + } + + public function setOutput($key, $out){ + + $this->output[$key] = $out; + + } + + public function show(){ + echo json_encode($this->output); + } + +} \ No newline at end of file -- cgit v1.2.3 From 7b9f17ba036f016078aea27565e1d31fce586b3f Mon Sep 17 00:00:00 2001 From: EoleDev Date: Wed, 10 Feb 2016 18:09:44 +0100 Subject: Add REST request management for Image Service --- server/core/App.php | 5 +++++ server/index.php | 7 +++++++ 2 files changed, 12 insertions(+) (limited to 'server/core/App.php') diff --git a/server/core/App.php b/server/core/App.php index 45f6922..dafdaad 100755 --- a/server/core/App.php +++ b/server/core/App.php @@ -35,6 +35,11 @@ class App{ $opt = $tokenClass->getOptions($service); return $this->openstack->identityV3($opt); break; + case "Image": + if($tokenPost == NULL) $tokenClass->genImageToken(); + $opt = $tokenClass->getOptions($service); + return $this->$openstack->imagesV2($opt); + break; } } diff --git a/server/index.php b/server/index.php index 41f77b8..166e82e 100755 --- a/server/index.php +++ b/server/index.php @@ -27,5 +27,12 @@ $identityObject->action($action); $App->show(); break; + + case "image": + include_once("core/Image.php"); + $imageObject = new image($App); + $imageObject->action($action); + $App->show(); + break; } -- cgit v1.2.3 From d81a376894b526b5769a553d07487b0b46fecaa2 Mon Sep 17 00:00:00 2001 From: Yoggzo Date: Thu, 11 Feb 2016 20:38:15 +0100 Subject: bugs --- server/Test/genTokenOptionsTest.php | 6 ++-- server/Test/imageTests.php | 5 ++-- server/core/App.php | 4 +-- server/core/Image.php | 55 ++++++++++++++++++++++++++++--------- 4 files changed, 50 insertions(+), 20 deletions(-) (limited to 'server/core/App.php') diff --git a/server/Test/genTokenOptionsTest.php b/server/Test/genTokenOptionsTest.php index 54c22d2..d1571f0 100755 --- a/server/Test/genTokenOptionsTest.php +++ b/server/Test/genTokenOptionsTest.php @@ -1,8 +1,8 @@ listServers(true); echo 'toto'; +$image = new Image($App); $opt = Array(); $opt['name'] = "Test"; @@ -46,7 +47,7 @@ $opt['minRam'] = 10; //Liste des images -$images = $imageObject->list_images(); +$images = $image->list_images(); echo "Images présentes :"; echo "
"; diff --git a/server/core/App.php b/server/core/App.php index dafdaad..09da394 100755 --- a/server/core/App.php +++ b/server/core/App.php @@ -1,6 +1,6 @@ oidentity = $ostack->imagesV2($options); - //$this->plugins = $apiP; + * @throws [Type] [] + * + * @return Image + */ + public function __construct($app){ + $this->app = $app; + $this->libClass = $app->getLibClass("Image"); } + + /** * Details about an image * -- cgit v1.2.3 From ad33435ce05302c76618fa77282811ade5a53119 Mon Sep 17 00:00:00 2001 From: EoleDev Date: Fri, 12 Feb 2016 11:57:18 +0100 Subject: Links Correction --- server/Test/genTokenOptionsTest.php | 6 +++--- server/core/App.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'server/core/App.php') diff --git a/server/Test/genTokenOptionsTest.php b/server/Test/genTokenOptionsTest.php index d1571f0..f7d0ee4 100755 --- a/server/Test/genTokenOptionsTest.php +++ b/server/Test/genTokenOptionsTest.php @@ -1,8 +1,8 @@ Date: Fri, 12 Feb 2016 12:11:11 +0100 Subject: Add Init and AppClass to do tests, Error Correction in App.php --- server/Test/AppTestClass.php | 73 ++++++++++++++++++++++++++++++++++++++++++++ server/Test/InitTest.php | 28 +++++++++++++++++ server/core/App.php | 10 +++--- 3 files changed, 106 insertions(+), 5 deletions(-) create mode 100755 server/Test/AppTestClass.php create mode 100755 server/Test/InitTest.php (limited to 'server/core/App.php') diff --git a/server/Test/AppTestClass.php b/server/Test/AppTestClass.php new file mode 100755 index 0000000..311b9bf --- /dev/null +++ b/server/Test/AppTestClass.php @@ -0,0 +1,73 @@ +tokenPost = NULL; + $this->tokenClass = new genTokenOptions($args); + $this->openstack = new OpenStack\OpenStack([]); + $this->pluginsApi = plugin_api::getInstance(); + $this->output = array(); + + } + + public function setToken($token){ + + $this->tokenPost = $token; + $this->tokenClass->loadBackup($his->tokenPost); + + } + + public function getLibClass($service){ + + switch($service){ + case "Identity": + if($this->tokenPost == NULL) $this->tokenClass->genIdentityToken(); + $opt = $this->tokenClass->getOptions($service); + return $this->openstack->identityV3($opt); + break; + case "Image": + if($this->tokenPost == NULL) $this->tokenClass->genImageToken(); + $opt = $this->tokenClass->getOptions($service); + return $this->openstack->imagesV2($opt); + break; + } + + } + + public function authenticate(){ + + try{ + $this->tokenClass->genIdentityToken(); + $this->tokenClass->genComputeToken(); + $this->tokenClass->genImageToken(); + $this->tokenClass->genNetworkToken(); + + $this->setOutput("token", $this->tokenClass->getBackup()); + }catch(Exception $e){ + echo $e; + exit(); + } + + } + + public function setOutput($key, $out){ + + $this->output[$key] = $out; + + } + + public function show(){ + echo json_encode($this->output); + } + +} \ No newline at end of file diff --git a/server/Test/InitTest.php b/server/Test/InitTest.php new file mode 100755 index 0000000..c1900a6 --- /dev/null +++ b/server/Test/InitTest.php @@ -0,0 +1,28 @@ + Array( + "name" => $user, + "password" => $password, + "domain" => Array( + "name" => "Default") + ), + "scope" => Array( + "project" => Array( + "name" => $project, + "domain" => Array( + "name" => "Default") + ) + ), + "authUrl" => $config["urlAuth"] + ); + + $App = new AppTest($Args); + +?> diff --git a/server/core/App.php b/server/core/App.php index dafdaad..bba99b4 100755 --- a/server/core/App.php +++ b/server/core/App.php @@ -31,14 +31,14 @@ class App{ switch($service){ case "Identity": - if($tokenPost == NULL) $tokenClass->genIdentityToken(); - $opt = $tokenClass->getOptions($service); + if($this->tokenPost == NULL) $this->tokenClass->genIdentityToken(); + $opt = $this->tokenClass->getOptions($service); return $this->openstack->identityV3($opt); break; case "Image": - if($tokenPost == NULL) $tokenClass->genImageToken(); - $opt = $tokenClass->getOptions($service); - return $this->$openstack->imagesV2($opt); + if($this->tokenPost == NULL) $this->tokenClass->genImageToken(); + $opt = $this->tokenClass->getOptions($service); + return $this->openstack->imagesV2($opt); break; } -- cgit v1.2.3 From 294fbb4d11b9399be231bd999447f2a214e11a1f Mon Sep 17 00:00:00 2001 From: EoleDev Date: Fri, 12 Feb 2016 12:45:00 +0100 Subject: ErrorManagement Class Introduction --- server/core/App.php | 32 ++++++++++++++++++++++++++-- server/core/ErrorManagement.php | 39 +++++++++++++++++++++++++++++++++++ server/core/Identity.php | 34 ++++++++++++++++++++++++++---- server/vendor/php-opencloud/openstack | 2 +- 4 files changed, 100 insertions(+), 7 deletions(-) create mode 100755 server/core/ErrorManagement.php (limited to 'server/core/App.php') diff --git a/server/core/App.php b/server/core/App.php index bba99b4..ff2e1af 100755 --- a/server/core/App.php +++ b/server/core/App.php @@ -1,13 +1,21 @@ tokenClass = new genTokenOptions($args); $this->openstack = new OpenStack\OpenStack([]); $this->pluginsApi = plugin_api::getInstance(); + $this->errorClass = new errorManagement($this); $this->output = array(); + $this->postParams = $_POST; } @@ -53,19 +63,37 @@ class App{ $this->tokenClass->genNetworkToken(); $this->setOutput("token", $this->tokenClass->getBackup()); - }catch(Exception $e){ - echo $e; + }catch(BadResponseError $e){ + var_dump($e); + }catch(UserInputError $e){ + var_dump($e); + }catch(BaseError $e){ + var_dump($e); exit(); + }catch(NotImplementedError $e){ + var_dump($e); } } + public function getPostParam($name){ + + return $this->postParams[$name]; + + } + public function setOutput($key, $out){ $this->output[$key] = $out; } + public function getErrorInstance(){ + + return $this->errorClass; + + } + public function show(){ echo json_encode($this->output); } diff --git a/server/core/ErrorManagement.php b/server/core/ErrorManagement.php new file mode 100755 index 0000000..ebd5abe --- /dev/null +++ b/server/core/ErrorManagement.php @@ -0,0 +1,39 @@ +app = $args; + + } + + public function BaseErrorHandler($error){ + + } + + public function BadResponseHandler($error){ + + } + + public function NotImplementedHandler($error){ + + } + + public function UserInputHandler($error){ + + } + + +} + +?> \ No newline at end of file diff --git a/server/core/Identity.php b/server/core/Identity.php index 7b6293c..1dc8373 100755 --- a/server/core/Identity.php +++ b/server/core/Identity.php @@ -9,7 +9,7 @@ * * @todo Complete the functions and finish the descriptions */ - +use OpenStack\Common\Error; /** * Identity Class of the back-end application @@ -59,6 +59,25 @@ class identity implements Core{ */ $credentials["addCredential"] = function(){ + $blob = $this->app->getPostParam("blob"); + $projectId = $this->app->getPostParam("projectId"); + $type = $this->app->getPostParam("type"); + $userId = $this->app->getPostParam("userId"); + + if(!isset($blob) || !isset($projectId) || !isset($type) || !isset($userId)){ + $this->app->setOutput("Error", "Parameters Incorrect"); + } + + try{ + + $opt = array('blob' => $blob, 'projectId' => $projectId, 'type' => $type, 'userId' => $userId); + $res = $this->libClass->createCredential($opt); + + }catch(Exception $e){ + + } + + ] } @@ -82,7 +101,8 @@ class identity implements Core{ * @return void */ $credentials["showCredential"] = function(){ - + $credential = $identity->getCredential('credentialId'); +$credential->retrieve(); } @@ -94,7 +114,12 @@ class identity implements Core{ * @return void */ $credentials["updateCredential"] = function(){ - + $credential = $identity->getCredential('credentialId'); + +$credential->type = 'foo'; +$credential->blob = 'bar'; + +$credential->update(); } @@ -106,7 +131,8 @@ class identity implements Core{ * @return void */ $credentials["deleteCredential"] = function(){ - + $credential = $identity->getCredential('credentialId'); +$credential->delete(); } diff --git a/server/vendor/php-opencloud/openstack b/server/vendor/php-opencloud/openstack index 15aca73..1419eb2 160000 --- a/server/vendor/php-opencloud/openstack +++ b/server/vendor/php-opencloud/openstack @@ -1 +1 @@ -Subproject commit 15aca73f423166c7ef8337ba08615c103c66e931 +Subproject commit 1419eb2e01164bb6b8b837df37724423907352d7 -- cgit v1.2.3 From 6890283bcf2e2f0cd0aa9923a18298fada6426c1 Mon Sep 17 00:00:00 2001 From: EoleDev Date: Fri, 12 Feb 2016 18:01:18 +0100 Subject: Identity Some functions Implementations, App error class binding on authenticate, ErrorManagement Implementation Beginning --- server/core/App.php | 17 ++-- server/core/ErrorManagement.php | 4 +- server/core/Identity.php | 221 ++++++++++++++++++++++++++++++++++++---- 3 files changed, 210 insertions(+), 32 deletions(-) (limited to 'server/core/App.php') diff --git a/server/core/App.php b/server/core/App.php index ff2e1af..babb3d9 100755 --- a/server/core/App.php +++ b/server/core/App.php @@ -64,15 +64,14 @@ class App{ $this->setOutput("token", $this->tokenClass->getBackup()); }catch(BadResponseError $e){ - var_dump($e); - }catch(UserInputError $e){ - var_dump($e); - }catch(BaseError $e){ - var_dump($e); - exit(); - }catch(NotImplementedError $e){ - var_dump($e); - } + $this->errorClass->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->errorClass->UserInputHandler($e); + }catch(BaseError $e){ + $this->errorClass->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->errorClass->NotImplementedHandler($e); + } } diff --git a/server/core/ErrorManagement.php b/server/core/ErrorManagement.php index ebd5abe..6bff61f 100755 --- a/server/core/ErrorManagement.php +++ b/server/core/ErrorManagement.php @@ -22,11 +22,11 @@ Class errorManagement{ } public function BadResponseHandler($error){ - + $this->app->setOutput("Error", "Erreur Interne, Merci de contacter un administrateur!"); } public function NotImplementedHandler($error){ - + $this->app->setOutput("Error", "Erreur Interne, Merci de contacter un administrateur!"); } public function UserInputHandler($error){ diff --git a/server/core/Identity.php b/server/core/Identity.php index df07f5d..7ad238b 100755 --- a/server/core/Identity.php +++ b/server/core/Identity.php @@ -53,10 +53,10 @@ class identity implements Core{ * Create a secret/access pair for use with ec2 style auth. * This operation will generates a new set of credentials that map the user/project pair. * - * @param JsonString $blob credentials information with this structure for ec2: "{\"access\":\"181920\",\"secret\":\"secretKey\"}" - * @param String $projectId project's UUID - * @param String $type Type of credential : ec2, cert... - * @param String $userId Id of the user which own the credential + * @param JsonString $blob Required credentials information with this structure for ec2: "{\"access\":\"181920\",\"secret\":\"secretKey\"}" + * @param String $projectId Required project's UUID + * @param String $type Required Type of credential : ec2, cert... + * @param String $userId Required Id of the user which own the credential * * @return void */ @@ -69,6 +69,7 @@ class identity implements Core{ if(!isset($blob) || !isset($projectId) || !isset($type) || !isset($userId)){ $this->app->setOutput("Error", "Parameters Incorrect"); + return; } try{ @@ -76,6 +77,8 @@ class identity implements Core{ $opt = array('blob' => $blob, 'projectId' => $projectId, 'type' => $type, 'userId' => $userId); $res = $this->libClass->createCredential($opt); + //TODO parse answer + }catch(BadResponseError $e){ $this->app->getErrorInstance->BadResponseHandler($e); }catch(UserInputError $e){ @@ -115,13 +118,17 @@ class identity implements Core{ /** * Retrieve a user’s access/secret pair by the access key. * - * @param String $credentialId credential id for which it retrieve the details + * @param String $credentialId Required credential id for which it retrieve the details * * @return void */ $credentials["showCredential"] = function(){ $credentId = $this->app->getPostParam("credentialId"); + if(!isset($credentId)){ + $this->app->setOutput("Error", "Parameters Incorrect"); + } + try{ $cred = $this->libClass->getCredential($credentId); @@ -144,93 +151,265 @@ class identity implements Core{ /** * Update a user’s access/secret pair. * - * @throws [Type] [] + * @param String $credentialId Required credential id to update + * @param JsonString $blob Required credentials information with this structure for ec2: "{\"access\":\"181920\",\"secret\":\"secretKey\"}" + * @param String $type Required Type of credential : ec2, cert... * * @return void */ $credentials["updateCredential"] = function(){ - $credential = $identity->getCredential('credentialId'); + + $credentId = $this->app->getPostParam("credentialId"); + $blob = $this->app->getPostParam("blob"); + $type = $this->app->getPostParam("type"); + + if(!isset($blob) || !isset($credentId) || !isset($type)){ + $this->app->setOutput("Error", "Parameters Incorrect"); + } + + + try{ + + $credential = $this->libClass->getCredential($credentId); -$credential->type = 'foo'; -$credential->blob = 'bar'; + $credential->type = $type; + $credential->blob = $blob; -$credential->update(); - + $credential->update(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance->NotImplementedHandler($e); + } } /** * Delete a user’s access/secret pair. * - * @throws [Type] [] + * @param String $credentialId Required credential id to delete * * @return void */ $credentials["deleteCredential"] = function(){ - $credential = $identity->getCredential('credentialId'); -$credential->delete(); - } + $credentId = $this->app->getPostParam("credentialId"); + + if(!isset($credentId)){ + $this->app->setOutput("Error", "Parameters Incorrect"); + } + + try{ + + $credential = $this->libClass->getCredential($credentId); + $credential->delete(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance->NotImplementedHandler($e); + } + }- $domains = array(); /** * Add a domain to an OpenStack instance. * - * @throws [Type] [] + * @param String $desc Optional Domain Description + * @param String $enabled Optional Domain enabled or not : value true or false + * @param String $name Required Domain Name * * @return void */ $domains["addDomain"] = function(){ + $description = $this->app->getPostParam("desc"); + $enabled = $this->app->getPostParam("enabled"); + $name = $this->app->getPostParam("name"); + + if(!isset($name)){ + $this->app->setOutput("Error", "Parameters Incorrect"); + return; + } + + if(isset($enabled) && isset($description)) + $opt = array('description' => $description, 'enabled' => $enabled, 'name' => $name); + elseif(isset($enabled)) + $opt = array('enabled' => $enabled, 'name' => $name); + elseif(isset($description)) + $opt = array('description' => $description, 'name' => $name); + else + $opt = array('name' => $name); + + try{ + + $res = $this->libClass->createCredential($opt); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance->NotImplementedHandler($e); + } } /** * Retrieve the different domain's list. * - * @throws [Type] [] - * * @return void */ $domains["listDomains"] = function(){ + try{ + + $this->libClass->listDomains() + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance->NotImplementedHandler($e); + } } /** * Retrieve the details of a given domain. * - * @throws [Type] [] + * @param String $domainId Required Domain id for which it retrieve the details * * @return void */ $domains["showDomain"] = function(){ + $domId = $this->app->getPostParam("domainId"); + + if(!isset($domId)){ + $this->app->setOutput("Error", "Parameters Incorrect"); + } + try{ + + $domain = $this->libClass->getDomain($domId); + $domain->retrieve(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance->NotImplementedHandler($e); + } } /** * Update the given domain. * - * @throws [Type] [] + * @param String $domainId Required domain id to update + * @param String $desc Optional Domain Description + * @param String $enabled Optional Domain enabled or not : value true or false + * @param String $name Required Domain Name * * @return void */ $domains["updateDomain"] = function(){ + $domId = $this->app->getPostParam("domainId"); + $description = $this->app->getPostParam("desc"); + $enabled = $this->app->getPostParam("enabled"); + $name = $this->app->getPostParam("name"); + + if(!isset($domId)){ + $this->app->setOutput("Error", "Parameters Incorrect"); + return; + } + + try{ + + $domain = $this->libClass->getDomain($domId); + + if(isset($name)) + $domain->name = $name; + if(isset($enabled)) + $domain->enabled = $enabled; + if(isset($description)) + $domain->description = $description; + + $domain->update(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance->NotImplementedHandler($e); + } } /** * Delete the given domain. * - * @throws [Type] [] + * @param String $domainId Required Domain id to delete * * @return void */ $domains["deleteDomain"] = function(){ + $domId = $this->app->getPostParam("domainId"); + if(!isset($domId)){ + $this->app->setOutput("Error", "Parameters Incorrect"); + } + + try{ + + $domain = $this->libClass->getDomain($domId); + $domain->delete(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance->NotImplementedHandler($e); + } } /** -- cgit v1.2.3 From 7e5db6b5420755a76c1efcd87bf2a61b111b4c09 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Wed, 17 Feb 2016 14:01:13 +0100 Subject: Use angular-cookirs --- client/index.html | 3 +- client/js/app.js | 3 +- client/js/controllers/.#status.js | 1 + client/js/controllers/login.js | 16 +++-- client/js/controllers/status.js | 11 ++- client/js/services/Identity.js | 77 +++++++++++++++++++-- client/js/services/Image.js | 21 +++--- client/partials/login.html | 2 +- client/partials/nav.html | 3 +- client/vendors/angularjs/angular-cookies.min.js | 9 +++ server/Test/genTokenOptionsTest.php | 0 server/composer.phar | Bin server/core/App.php | 0 server/core/CoreInterface.php | 0 server/core/Identity.php | 0 server/core/LibOverride/genTokenOptions.php | 0 server/index.php | 0 server/init.php | 0 .../justinrainbow/json-schema/bin/validate-json | 0 19 files changed, 119 insertions(+), 27 deletions(-) create mode 120000 client/js/controllers/.#status.js create mode 100644 client/vendors/angularjs/angular-cookies.min.js mode change 100755 => 100644 server/Test/genTokenOptionsTest.php mode change 100755 => 100644 server/composer.phar mode change 100755 => 100644 server/core/App.php mode change 100755 => 100644 server/core/CoreInterface.php mode change 100755 => 100644 server/core/Identity.php mode change 100755 => 100644 server/core/LibOverride/genTokenOptions.php mode change 100755 => 100644 server/index.php mode change 100755 => 100644 server/init.php mode change 100755 => 100644 server/vendor/justinrainbow/json-schema/bin/validate-json (limited to 'server/core/App.php') diff --git a/client/index.html b/client/index.html index ab5f00f..26430f9 100644 --- a/client/index.html +++ b/client/index.html @@ -61,7 +61,7 @@ - + @@ -69,6 +69,7 @@ + diff --git a/client/js/app.js b/client/js/app.js index 90fae89..e2d5b9b 100644 --- a/client/js/app.js +++ b/client/js/app.js @@ -3,7 +3,7 @@ * The main app module instance * @type angular.module.angular-1_3_6_L1749.moduleInstance */ -var mainApp=angular.module("mainApp",['ngRoute', 'ngSanitize']); +var mainApp=angular.module("mainApp",['ngRoute', 'ngSanitize', 'ngCookies']); /** * Configure routeProvider @@ -29,6 +29,5 @@ mainApp.config(['$routeProvider', function($routeProvider){ */ mainApp.config(['$httpProvider', function($httpProvider){ $httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'; - }]); diff --git a/client/js/controllers/.#status.js b/client/js/controllers/.#status.js new file mode 120000 index 0000000..e6c258f --- /dev/null +++ b/client/js/controllers/.#status.js @@ -0,0 +1 @@ +loic@Manzerbredes.home.30343:1455008378 \ No newline at end of file diff --git a/client/js/controllers/login.js b/client/js/controllers/login.js index 6358a6d..829fc1d 100644 --- a/client/js/controllers/login.js +++ b/client/js/controllers/login.js @@ -9,14 +9,20 @@ */ mainApp.controller('loginCtrl', ['$scope','$sce','Identity', function ($scope,$sce, Identity) { - // Define default states - $('#loginModal').modal({backdrop: 'static', keyboard: false}); + // Check for login and define default states + if(!Identity.isAlreadyLogin()){ + $('#loginModal').modal({backdrop: 'static', keyboard: false}); + } + $scope.$on('logoutEvent', function(){ + $('#loginModal').modal({backdrop: 'static', keyboard: false}); + }); + $('#loadingLoginButton').hide(); $('#failedToLoginAlert').hide(); - $('#loginButton').click(function(){ - + $scope.loginAction=function(){ + // Begin login state for template $('#loginButton').hide(); $('#loadingLoginButton').show(); @@ -49,6 +55,6 @@ mainApp.controller('loginCtrl', ['$scope','$sce','Identity', function ($scope,$s // Try to login Identity.login(username, password, projectname, responseCallback); - }); + }; }]); diff --git a/client/js/controllers/status.js b/client/js/controllers/status.js index 2930e34..6bc602a 100644 --- a/client/js/controllers/status.js +++ b/client/js/controllers/status.js @@ -6,9 +6,14 @@ * @param {$scope} $scope The $scope service from angular * @param {Identity} The Identity service */ -mainApp.controller('statusCtrl', ['$scope','Identity', function ($scope, Identity) +mainApp.controller('statusCtrl', ['$scope','Identity', '$rootScope', function ($scope, Identity, $rootScope) { $scope.profile=Identity.profile; - - + + $scope.logout=function(){ + Identity.logout(); + $rootScope.$broadcast('logoutEvent'); + + }; + }]); diff --git a/client/js/services/Identity.js b/client/js/services/Identity.js index 4c8919c..d96b3ab 100644 --- a/client/js/services/Identity.js +++ b/client/js/services/Identity.js @@ -1,5 +1,5 @@ -mainApp.factory('Identity',[ '$http', function($http){ +mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){ /* Create profile structure to store informations * about current session @@ -9,7 +9,72 @@ mainApp.factory('Identity',[ '$http', function($http){ profile.projectname=null; profile.token=null; +/* var tokenFragment=9; + + var saveTokenInCookies=function(){ + var i=0; + var currentStart=0; + var currentEnd=parseInt(profile.token.length/tokenFragment); + var facto=currentEnd; + + alert("current ren" + currentEnd); + for(i=0;iClose--> - Login + Login diff --git a/client/partials/nav.html b/client/partials/nav.html index 7c34174..3c72844 100644 --- a/client/partials/nav.html +++ b/client/partials/nav.html @@ -32,8 +32,7 @@
  • Informations
  • Settings
  • -
  • Logout -
  • +
  • Logout
  • diff --git a/client/vendors/angularjs/angular-cookies.min.js b/client/vendors/angularjs/angular-cookies.min.js new file mode 100644 index 0000000..d0f126a --- /dev/null +++ b/client/vendors/angularjs/angular-cookies.min.js @@ -0,0 +1,9 @@ +/* + AngularJS v1.5.0 + (c) 2010-2016 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(p,c,n){'use strict';function l(b,a,g){var d=g.baseHref(),k=b[0];return function(b,e,f){var g,h;f=f||{};h=f.expires;g=c.isDefined(f.path)?f.path:d;c.isUndefined(e)&&(h="Thu, 01 Jan 1970 00:00:00 GMT",e="");c.isString(h)&&(h=new Date(h));e=encodeURIComponent(b)+"="+encodeURIComponent(e);e=e+(g?";path="+g:"")+(f.domain?";domain="+f.domain:"");e+=h?";expires="+h.toUTCString():"";e+=f.secure?";secure":"";f=e.length+1;4096 4096 bytes)!");k.cookie=e}}c.module("ngCookies",["ng"]).provider("$cookies",[function(){var b=this.defaults={};this.$get=["$$cookieReader","$$cookieWriter",function(a,g){return{get:function(d){return a()[d]},getObject:function(d){return(d=this.get(d))?c.fromJson(d):d},getAll:function(){return a()},put:function(d,a,m){g(d,a,m?c.extend({},b,m):b)},putObject:function(d,b,a){this.put(d,c.toJson(b),a)},remove:function(a,k){g(a,n,k?c.extend({},b,k):b)}}}]}]);c.module("ngCookies").factory("$cookieStore", +["$cookies",function(b){return{get:function(a){return b.getObject(a)},put:function(a,c){b.putObject(a,c)},remove:function(a){b.remove(a)}}}]);l.$inject=["$document","$log","$browser"];c.module("ngCookies").provider("$$cookieWriter",function(){this.$get=l})})(window,window.angular); +//# sourceMappingURL=angular-cookies.min.js.map diff --git a/server/Test/genTokenOptionsTest.php b/server/Test/genTokenOptionsTest.php old mode 100755 new mode 100644 diff --git a/server/composer.phar b/server/composer.phar old mode 100755 new mode 100644 diff --git a/server/core/App.php b/server/core/App.php old mode 100755 new mode 100644 diff --git a/server/core/CoreInterface.php b/server/core/CoreInterface.php old mode 100755 new mode 100644 diff --git a/server/core/Identity.php b/server/core/Identity.php old mode 100755 new mode 100644 diff --git a/server/core/LibOverride/genTokenOptions.php b/server/core/LibOverride/genTokenOptions.php old mode 100755 new mode 100644 diff --git a/server/index.php b/server/index.php old mode 100755 new mode 100644 diff --git a/server/init.php b/server/init.php old mode 100755 new mode 100644 diff --git a/server/vendor/justinrainbow/json-schema/bin/validate-json b/server/vendor/justinrainbow/json-schema/bin/validate-json old mode 100755 new mode 100644 -- cgit v1.2.3