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