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/Identity.php | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) mode change 100644 => 100755 server/core/Identity.php (limited to 'server/core/Identity.php') diff --git a/server/core/Identity.php b/server/core/Identity.php old mode 100644 new mode 100755 index 343ed15..d607957 --- a/server/core/Identity.php +++ b/server/core/Identity.php @@ -1,19 +1,28 @@ oidentity = $ostack->identityV3(); - $this->plugins = $apiP; + $this->app = $app; + if($app->getOptions("Identity")) + $this->libClass = $app->getLibClass("Identity"); } + public function action($action){ + + //To be Complete + + } + public function genToken(){ - global $Args; - $token = $this->oidentity->generateToken($Args); - return $token; - } + + //To be Complete + + } } -- cgit v1.2.3 From 1cd1ae92f414573942262f65dc1644e8ff9bb8f6 Mon Sep 17 00:00:00 2001 From: EoleDev Date: Sun, 7 Feb 2016 22:42:33 +0100 Subject: Structure identity Class, beginning of descriptions. --- server/core/Identity.php | 929 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 920 insertions(+), 9 deletions(-) (limited to 'server/core/Identity.php') diff --git a/server/core/Identity.php b/server/core/Identity.php index d607957..7b6293c 100755 --- a/server/core/Identity.php +++ b/server/core/Identity.php @@ -1,28 +1,939 @@ ] + * + * @return identity + */ public function __construct($app){ $this->app = $app; - if($app->getOptions("Identity")) $this->libClass = $app->getLibClass("Identity"); - } + } - public function action($action){ + $credentials = array(); + + /** + * Add a credential for the given user/project. + * + * 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. + * + * @throws [Type] [] + * + * @return void + */ + $credentials["addCredential"] = function(){ - //To be Complete } - public function genToken(){ - - //To be Complete + /** + * List the credentials for a given user. + * + * @throws [Type] [] + * + * @return void + */ + $credentials["listCredentials"] = function(){ + + + } + + /** + * Retrieve a user’s access/secret pair by the access key. + * + * @throws [Type] [] + * + * @return void + */ + $credentials["showCredential"] = function(){ + + + } + + /** + * Update a user’s access/secret pair. + * + * @throws [Type] [] + * + * @return void + */ + $credentials["updateCredential"] = function(){ + + + } + + /** + * Delete a user’s access/secret pair. + * + * @throws [Type] [] + * + * @return void + */ + $credentials["deleteCredential"] = function(){ + + + } + + $domains = array(); + + /** + * Add a domain to an OpenStack instance. + * + * @throws [Type] [] + * + * @return void + */ + $domains["addDomain"] = function(){ + + + } + + /** + * Retrieve the different domain's list. + * + * @throws [Type] [] + * + * @return void + */ + $domains["listDomains"] = function(){ + + + } + + /** + * Retrieve the details of a given domain. + * + * @throws [Type] [] + * + * @return void + */ + $domains["showDomain"] = function(){ + + + } + + /** + * Update the given domain. + * + * @throws [Type] [] + * + * @return void + */ + $domains["updateDomain"] = function(){ + + + } + + /** + * Delete the given domain. + * + * @throws [Type] [] + * + * @return void + */ + $domains["deleteDomain"] = function(){ + + + } + + /** + * Retrieve the different roles of a given user in a domain. + * + * @throws [Type] [] + * + * @return void + */ + $domains["listRolesDomainUser"] = function(){ + + + } + + /** + * Grant a role to a given user in a domain. + * + * @throws [Type] [] + * + * @return void + */ + $domains["grantRoleDomainUser"] = function(){ + + + } + + /** + * Verify that a user has a given role in a domain. + * + * @throws [Type] [] + * + * @return void + */ + $domains["checkRoleDomainUser"] = function(){ + + + } + + /** + * Delete a role for a given user in a domain. + * + * @throws [Type] [] + * + * @return void + */ + $domains["revokeRoleDomainUser"] = function(){ + + + } + + /** + * Retrieve the roles of a given group in a domain. + * + * @throws [Type] [] + * + * @return void + */ + $domains["listRolesDomainGroup"] = function(){ + + + } + + /** + * Add a role to a given group in a domain. + * + * @throws [Type] [] + * + * @return void + */ + $domains["grantRoleDomainGroup"] = function(){ + + + } + + /** + * Verify that a role is associated with a given group in a domain. + * + * @throws [Type] [] + * + * @return void + */ + $domains["checkRoleDomainGroup"] = function(){ + + + } + + /** + * Delete a role for a given group in a domain. + * + * A *description*, that can span multiple lines, to go _in-depth_ into the details of this element + * and to provide some background information or textual references. + * + * @param string $myArgument With a *description* of this argument, these may also + * span multiple lines. + * + * @throws [Type] [] + * + * @return void + */ + $domains["revokeRoleDomainGroup"] = function(){ + + + } + + $endpoints = array(); + + /** + * Add an endpoint to the Openstack instance + * + * @throws [Type] [] + * + * @return void + */ + $endpoints["addEndpoint"] = function(){ + + + } + + /** + * Retrieve the endpoint for the given id + * + * @throws [Type] [] + * + * @return void + */ + $endpoints["getEndpoint"] = function(){ + + + } + + /** + * Retrieve the list of the different endpoints + * + * @throws [Type] [] + * + * @return void + */ + $endpoints["listEndpoints"] = function(){ + + + } + + /** + * Update a given endpoint + * + * @throws [Type] [] + * + * @return void + */ + $endpoints["updateEndpoint"] = function(){ + + + } + + /** + * Delete a given endpoint + * + * @throws [Type] [] + * + * @return void + */ + $endpoints["deleteEndpoint"] = function(){ + + + } + + $groups = array(); + + /** + * Add a group. + * + * @throws [Type] [] + * + * @return void + */ + $groups["addGroup"] = function(){ + + + } + + /** + * Retrieve the group's list. + * + * @throws [Type] [] + * + * @return void + */ + $groups["listGroups"] = function(){ + + + } + + /** + * Retrieve the details of a given group. + * + * @throws [Type] [] + * + * @return void + */ + $groups["showGroup"] = function(){ + + + } + + /** + * Update a given group. + * + * @throws [Type] [] + * + * @return void + */ + $groups["updateGroup"] = function(){ + + + } + + /** + * Delete the given group. + * + * @throws [Type] [] + * + * @return void + */ + $groups["deleteGroup"] = function(){ + + + } + + /** + * Retrieve the users of a given group. + * + * @throws [Type] [] + * + * @return void + */ + $groups["listGroupUsers"] = function(){ + + + } + + /** + * Add a user to a group. + * + * @throws [Type] [] + * + * @return void + */ + $groups["addGroupUser"] = function(){ + + + } + + /** + * Remove a user from a given group. + * + * @throws [Type] [] + * + * @return void + */ + $groups["removeGroupUser"] = function(){ + + + } + + /** + * Check if a group contains a given user. + * + * @throws [Type] [] + * + * @return void + */ + $groups["checkGroupUser"] = function(){ + + + } + + $policies = array(); + + /** + * @todo + * + * @throws [Type] [] + * + * @return void + */ + $policies["addPolicies"] = function(){ + + + } + + /** + * @todo + * + * @throws [Type] [] + * + * @return void + */ + $policies["listPolicies"] = function(){ + + + } + + /** + * @todo + * + * @throws [Type] [] + * + * @return void + */ + $policies["showPolicie"] = function(){ + + + } + + /** + * @todo + * + * @throws [Type] [] + * + * @return void + */ + $policies["updatePolicies"] = function(){ + } + + /** + * @todo + * + * @throws [Type] [] + * + * @return void + */ + $policies["deletePolicies"] = function(){ + + + } + + $projects = array(); + + /** + * Add a project. + * + * @throws [Type] [] + * + * @return void + */ + $projects["addProject"] = function(){ + + + } + + /** + * Retrieve the different projects. + * + * @throws [Type] [] + * + * @return void + */ + $projects["listProjects"] = function(){ + + + } + + /** + * Retrieve the details of a given project. + * + * @throws [Type] [] + * + * @return void + */ + $projects["showProject"] = function(){ + + + } + + /** + * Update a given project. + * + * @throws [Type] [] + * + * @return void + */ + $projects["updateProject"] = function(){ + + + } + + /** + * Delete a given project. + * + * @throws [Type] [] + * + * @return void + */ + $projects["deleteProject"] = function(){ + + + } + + /** + * List the roles of a given user in a project. + * + * @throws [Type] [] + * + * @return void + */ + $projects["listRolesProjectUser"] = function(){ + + + } + + /** + * Grant a role to an user in a project. + * + * @throws [Type] [] + * + * @return void + */ + $projects["grantRoleProjectUser"] = function(){ + + + } + + /** + * Check if a given user has a role in a project. + * + * @throws [Type] [] + * + * @return void + */ + $projects["checkRoleProjectUser"] = function(){ + + + } + + /** + * Delete a role for a given user in a project. + * + * @throws [Type] [] + * + * @return void + */ + $projects["revokeRoleProjectUser"] = function(){ + + + } + + /** + * List the roles of a group in a project. + * + * @throws [Type] [] + * + * @return void + */ + $projects["listRolesProjectGroup"] = function(){ + + + } + + /** + * Add a role to a group in a project. + * + * @throws [Type] [] + * + * @return void + */ + $projects["grantRoleProjectGroup"] = function(){ + + + } + + /** + * Check if a group has a given role in a project. + * + * @throws [Type] [] + * + * @return void + */ + $projects["checkRoleProjectGroup"] = function(){ + + + } + + /** + * Delete a role for a group in a project. + * + * @throws [Type] [] + * + * @return void + */ + $projects["revokeRoleProjectGroup"] = function(){ + + + } + + $roles = array(); + + /** + * Add a role. + * + * @throws [Type] [] + * + * @return void + */ + $roles["addRole"] = function(){ + + + } + + /** + * List the different roles + * + * @throws [Type] [] + * + * @return void + */ + $roles["listRoles"] = function(){ + + + } + + /** + * @todo + * + * @throws [Type] [] + * + * @return void + */ + $roles["listRoleAssignements"] = function(){ + + + } + + $services = array(); + + /** + * Add a service. + * + * @throws [Type] [] + * + * @return void + */ + $services["addService"] = function(){ + + + } + + /** + * Retrieve the different services. + * + * @throws [Type] [] + * + * @return void + */ + $services["listServices"] = function(){ + + + } + + /** + * Retrieve the details for a given service. + * + * @throws [Type] [] + * + * @return void + */ + $services["showService"] = function(){ + + + } + + /** + * Delete a given service. + * + * @throws [Type] [] + * + * @return void + */ + $services["deleteService"] = function(){ + + + } + + $tokens = array(); + + /** + * Generate a new token for a given user id. + * + * @throws [Type] [] + * + * @return void + */ + $tokens["genTokenUserID"] = function(){ + + + } + + /** + * Generate a new token for a given user name. + * + * @throws [Type] [] + * + * @return void + */ + $tokens["genTokenUserName"] = function(){ + + + } + + /** + * Generate a new token from another token ID. + * + * @throws [Type] [] + * + * @return void + */ + $tokens["geneTokenID"] = function(){ + + + } + + /** + * Generate a new token scoped by a project ID. + * + * @throws [Type] [] + * + * @return void + */ + $tokens["genTokenScopedProjectID"] = function(){ + + + } + + /** + * Generate a new token scoped by a project name. + * + * @throws [Type] [] + * + * @return void + */ + $tokens["genTokenScopedProjectName"] = function(){ + + + } + + /** + * Check if a token is validate. + * + * @throws [Type] [] + * + * @return void + */ + $tokens["validateToken"] = function(){ + + + } + + /** + * Delete a given token. + * + * @throws [Type] [] + * + * @return void + */ + $tokens["revokeToken"] = function(){ + + + } + + $users = array(); + + /** + * Add a new user. + * + * @throws [Type] [] + * + * @return void + */ + $users["addUser"] = function(){ + + + } + + /** + * Retrieve the different users. + * + * @throws [Type] [] + * + * @return void + */ + $users["listUsers"] = function(){ + + + } + + /** + * Retrieve the details of a given user. + * + * @throws [Type] [] + * + * @return void + */ + $users["showUser"] = function(){ + + + } + + /** + * Update a given user. + * + * @throws [Type] [] + * + * @return void + */ + $users["updateUser"] = function(){ + + + } + + /** + * Delete a given user. + * + * @throws [Type] [] + * + * @return void + */ + $users["deleteUser"] = function(){ + + + } + + /** + * Retrieve the groups which contains a given user. + * + * @throws [Type] [] + * + * @return void + */ + $users["listUserGroups"] = function(){ + + + } + + /** + * Retrieve the projects which contains a given user. + * + * @throws [Type] [] + * + * @return void + */ + $users["listUserProjects"] = function(){ + + + } + + $actions["Credentials"] = $credentials; + $actions["Domains"] = $domains; + $actions["Endpoints"] = $endpoints; + $actions["Groups"] = $groups; + $actions["Policies"] = $policies; + $actions["Projects"] = $projects; + $actions["Roles"] = $roles; + $actions["Services"] = $services; + $actions["Tokens"] = $tokens; + $actions["Users"] = $users; } -- 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/Identity.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 6960c81a1f2d4f39135e7d8cc5fa32c42e36b21c Mon Sep 17 00:00:00 2001 From: EoleDev Date: Fri, 12 Feb 2016 15:45:25 +0100 Subject: Identity Class first function --- server/core/Identity.php | 59 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 12 deletions(-) (limited to 'server/core/Identity.php') diff --git a/server/core/Identity.php b/server/core/Identity.php index 1dc8373..df07f5d 100755 --- a/server/core/Identity.php +++ b/server/core/Identity.php @@ -53,7 +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. * - * @throws [Type] [] + * @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 * * @return void */ @@ -73,36 +76,68 @@ class identity implements Core{ $opt = array('blob' => $blob, 'projectId' => $projectId, 'type' => $type, 'userId' => $userId); $res = $this->libClass->createCredential($opt); - }catch(Exception $e){ - - } - - ] + }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); + } } /** * List the credentials for a given user. * - * @throws [Type] [] - * * @return void */ $credentials["listCredentials"] = function(){ - + try{ + + $this->libClass->listCredentials() + + //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 a user’s access/secret pair by the access key. * - * @throws [Type] [] + * @param String $credentialId credential id for which it retrieve the details * * @return void */ $credentials["showCredential"] = function(){ - $credential = $identity->getCredential('credentialId'); -$credential->retrieve(); + $credentId = $this->app->getPostParam("credentialId"); + + try{ + + $cred = $this->libClass->getCredential($credentId); + $cred->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); + } } -- 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/Identity.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 219847749e0cb26f11c0f4231fccdcb73e919d97 Mon Sep 17 00:00:00 2001 From: EoleDev Date: Fri, 12 Feb 2016 20:03:21 +0100 Subject: Implementation Major Functionality --- server/core/Identity.php | 1482 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 1448 insertions(+), 34 deletions(-) (limited to 'server/core/Identity.php') diff --git a/server/core/Identity.php b/server/core/Identity.php index 7ad238b..00199ec 100755 --- a/server/core/Identity.php +++ b/server/core/Identity.php @@ -421,7 +421,30 @@ class identity implements Core{ */ $domains["listRolesDomainUser"] = function(){ + $domId = $this->app->getPostParam("domainId"); + $userId = $this->app->getPostParam("userId"); + + if(!isset($domId) || !isset($userId)){ + + } + try{ + + $domain = $this->libClass->getDomain($domId); + + $domain->listUserRoles(['userId' => $userId]); + + //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); + } } /** @@ -432,8 +455,34 @@ class identity implements Core{ * @return void */ $domains["grantRoleDomainUser"] = function(){ + $domId = $this->app->getPostParam("domainId"); + $roleId = $this->app->getPostParam("roleId"); + $userId = $this->app->getPostParam("userId"); + if(!isset($domId) || !isset($roleId) || !isset($userId)){ + + } + try{ + + $domain = $this->libClass->getDomain($domId); + + $domain->grantUserRole([ + 'userId' => $userId, + 'roleId' => $roleId, + ]); + + //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); + } } /** @@ -444,8 +493,35 @@ class identity implements Core{ * @return void */ $domains["checkRoleDomainUser"] = function(){ + $domId = $this->app->getPostParam("domainId"); + $roleId = $this->app->getPostParam("roleId"); + $userId = $this->app->getPostParam("userId"); - + if(!isset($domId) || !isset($roleId) || !isset($userId)){ + + } + + try{ + + $domain = $this->libClass->getDomain($domId); + + $result = $domain->checkUserRole(['userId' => $userId, 'roleId' => $roleId]); + + /*if (true === $result) { + // It exists! + }*/ + + //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); + } } /** @@ -456,8 +532,34 @@ class identity implements Core{ * @return void */ $domains["revokeRoleDomainUser"] = function(){ + $domId = $this->app->getPostParam("domainId"); + $roleId = $this->app->getPostParam("roleId"); + $userId = $this->app->getPostParam("userId"); + if(!isset($domId) || !isset($roleId) || !isset($userId)){ + + } + try{ + + $domain = $this->libClass->getDomain($domId); + + $domain->revokeUserRole([ + 'userId' => $userId, + 'roleId' => $roleId, + ]); + + //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); + } } /** @@ -468,8 +570,31 @@ class identity implements Core{ * @return void */ $domains["listRolesDomainGroup"] = function(){ + $domId = $this->app->getPostParam("domainId"); + $groupId = $this->app->getPostParam("groupId"); - + if(!isset($domId) || !isset($groupId)){ + + } + + + try{ + + $domain = $this->libClass->getDomain($domId); + + $domain->listGroupRoles(['groupId' => $groupId]); + + //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); + } } /** @@ -480,8 +605,34 @@ class identity implements Core{ * @return void */ $domains["grantRoleDomainGroup"] = function(){ + $domId = $this->app->getPostParam("domainId"); + $groupId = $this->app->getPostParam("groupId"); + $roleId = $this->app->getPostParam("roleId"); - + if(!isset($domId) || !isset($groupId) || !isset($roleId)){ + + } + + try{ + + $domain = $this->libClass->getDomain($domId); + + $domain->grantGroupRole([ + 'groupId' => $groupId, + 'roleId' => $roleId, + ]); + + //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); + } } /** @@ -492,8 +643,35 @@ class identity implements Core{ * @return void */ $domains["checkRoleDomainGroup"] = function(){ + $domId = $this->app->getPostParam("domainId"); + $groupId = $this->app->getPostParam("groupId"); + $roleId = $this->app->getPostParam("roleId"); - + if(!isset($domId) || !isset($groupId) || !isset($roleId)){ + + } + + try{ + + $domain = $this->libClass->getDomain($domId); + + $result = $domain->checkGroupRole(['groupId' => $groupId, 'roleId' => $roleId]); + + /*if (true === $result) { + // It exists! + }*/ + + //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); + } } /** @@ -510,8 +688,35 @@ class identity implements Core{ * @return void */ $domains["revokeRoleDomainGroup"] = function(){ + $domId = $this->app->getPostParam("domainId"); + $groupId = $this->app->getPostParam("groupId"); + $roleId = $this->app->getPostParam("roleId"); + if(!isset($domId) || !isset($groupId) || !isset($roleId)){ + + } + try{ + + $domain = $this->libClass->getDomain($roleId); + + $domain->revokeGroupRole([ + 'groupId' => $groupId, + 'roleId' => $roleId, + ]); + + + //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); + } } $endpoints = array(); @@ -524,8 +729,36 @@ class identity implements Core{ * @return void */ $endpoints["addEndpoint"] = function(){ + $servId = $this->app->getPostParam("serviceId"); + $name = $this->app->getPostParam("name"); + $region = $this->app->getPostParam("region"); + $url = $this->app->getPostParam("url"); + if(!isset($servId) || !isset($name) || !isset($region) || !isset($url)){ + + } + try{ + + $endpoint = $this->libClass->createEndpoint([ + 'interface' => \OpenStack\Identity\v3\Enum::INTERFACE_INTERNAL, + 'name' => $name, + 'region' => $region, + 'url' => $url, + 'serviceId' => $servId + ]); + + //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); + } } /** @@ -537,19 +770,51 @@ class identity implements Core{ */ $endpoints["getEndpoint"] = function(){ + $endId = $this->app->getPostParam("endpointId"); + + if(!isset($endId)){ + + } + try{ + + $endpoint = $this->libClass->getEndpoint($endId); + + //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 list of the different endpoints * - * @throws [Type] [] - * * @return void */ $endpoints["listEndpoints"] = function(){ - - + + try{ + + $res = $this->libClass->listEndpoints(); + + //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); + } } /** @@ -560,8 +825,35 @@ class identity implements Core{ * @return void */ $endpoints["updateEndpoint"] = function(){ + //Not Implemented Yet + /*$domId = $this->app->getPostParam("domainId"); + $groupId = $this->app->getPostParam("groupId"); + if(!isset($domId) || !isset($groupId)){ + + } + + //TODO PARAMETERS + try{ + + $endpoint = $this->libClass->getEndpoint('{endpointId}'); + + $endpoint->interface = \OpenStack\Identity\v3\Enum::INTERFACE_PUBLIC; + + $endpoint->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); + }*/ } /** @@ -572,8 +864,28 @@ class identity implements Core{ * @return void */ $endpoints["deleteEndpoint"] = function(){ + $endId = $this->app->getPostParam("endpointId"); + if(!isset($endId)){ + + } + try{ + + $endpoint = $this->libClass->getEndpoint($endId); + $endpoint->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); + } } $groups = array(); @@ -586,10 +898,31 @@ class identity implements Core{ * @return void */ $groups["addGroup"] = function(){ + //Not Implemented Yet + /*$domId = $this->app->getPostParam("domainId"); + $groupId = $this->app->getPostParam("groupId"); - } - + if(!isset($domId) || !isset($groupId)){ + + } + try{ + + $this->libClass->listCredentials() + + //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 group's list. * @@ -598,8 +931,29 @@ class identity implements Core{ * @return void */ $groups["listGroups"] = function(){ + //Not Implemented Yet + /* + $domId = $this->app->getPostParam("domainId"); + $groupId = $this->app->getPostParam("groupId"); - + if(!isset($domId) || !isset($groupId)){ + + } + try{ + + $this->libClass->listCredentials() + + //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); + }*/ } /** @@ -610,8 +964,30 @@ class identity implements Core{ * @return void */ $groups["showGroup"] = function(){ + //Not Implemented Yet + /* + $domId = $this->app->getPostParam("domainId"); + $groupId = $this->app->getPostParam("groupId"); + if(!isset($domId) || !isset($groupId)){ + + } + try{ + + $this->libClass->listCredentials() + + //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); + }*/ } /** @@ -622,8 +998,37 @@ class identity implements Core{ * @return void */ $groups["updateGroup"] = function(){ + //Todo Argument Optional + $groupId = $this->app->getPostParam("groupId"); + $description = $this->app->getPostParam("description"); + $name = $this->app->getPostParam("name"); + if(!isset($groupId)){ + + } + try{ + + $group = $this->libClass->getGroup($groupId); + + if(isset($description)) + $group->description = 'foo'; + if(isset($name)) + $group->name = 'bar'; + + $group->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); + } } /** @@ -635,7 +1040,29 @@ class identity implements Core{ */ $groups["deleteGroup"] = function(){ + $groupId = $this->app->getPostParam("groupId"); + + if(!isset($groupId)){ + + } + try{ + + $group = $this->libClass->getGroup($groupId); + + $group->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); + } } /** @@ -647,7 +1074,29 @@ class identity implements Core{ */ $groups["listGroupUsers"] = function(){ + $groupId = $this->app->getPostParam("groupId"); + if(!isset($groupId)){ + + } + + try{ + + $group = $this->libClass->getGroup($groupId); + + $users = $group->listUsers(); + + //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); + } } /** @@ -659,7 +1108,30 @@ class identity implements Core{ */ $groups["addGroupUser"] = function(){ + $userId = $this->app->getPostParam("userId"); + $groupId = $this->app->getPostParam("groupId"); + if(!isset($userId) || !isset($groupId)){ + + } + + try{ + + $group = $this->libClass->getGroup($groupId); + + $group->addUser(['userId' => $userId]); + + //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); + } } /** @@ -671,7 +1143,30 @@ class identity implements Core{ */ $groups["removeGroupUser"] = function(){ + $userId = $this->app->getPostParam("userId"); + $groupId = $this->app->getPostParam("groupId"); + + if(!isset($userId) || !isset($groupId)){ + + } + try{ + + $group = $this->libClass->getGroup($groupId); + + $group->removeUser(['userId' => $userId]); + + //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); + } } /** @@ -683,7 +1178,30 @@ class identity implements Core{ */ $groups["checkGroupUser"] = function(){ + $userId = $this->app->getPostParam("userId"); + $groupId = $this->app->getPostParam("groupId"); + + if(!isset($userId) || !isset($groupId)){ + + } + try{ + + $group = $this->libClass->getGroup($groupId); + + $result = $group->checkMembership(['userId' => $userId]); + + //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); + } } $policies = array(); @@ -696,8 +1214,29 @@ class identity implements Core{ * @return void */ $policies["addPolicies"] = function(){ + //Not Implemented Yet + /* + $domId = $this->app->getPostParam("domainId"); + $groupId = $this->app->getPostParam("groupId"); - + if(!isset($domId) || !isset($groupId)){ + + } + try{ + + $this->libClass->listCredentials() + + //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); + }*/ } /** @@ -708,8 +1247,29 @@ class identity implements Core{ * @return void */ $policies["listPolicies"] = function(){ + //Not Implemented Yet + /* + $domId = $this->app->getPostParam("domainId"); + $groupId = $this->app->getPostParam("groupId"); - + if(!isset($domId) || !isset($groupId)){ + + } + try{ + + $this->libClass->listCredentials() + + //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); + }*/ } /** @@ -720,7 +1280,29 @@ class identity implements Core{ * @return void */ $policies["showPolicie"] = function(){ + //Not Implemented Yet + /* + $domId = $this->app->getPostParam("domainId"); + $groupId = $this->app->getPostParam("groupId"); + if(!isset($domId) || !isset($groupId)){ + + } + try{ + + $this->libClass->listCredentials() + + //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); + }*/ } @@ -732,8 +1314,29 @@ class identity implements Core{ * @return void */ $policies["updatePolicies"] = function(){ + //Not Implemented Yet + /* + $domId = $this->app->getPostParam("domainId"); + $groupId = $this->app->getPostParam("groupId"); - + if(!isset($domId) || !isset($groupId)){ + + } + try{ + + $this->libClass->listCredentials() + + //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); + }*/ } /** @@ -744,8 +1347,29 @@ class identity implements Core{ * @return void */ $policies["deletePolicies"] = function(){ + //Not Implemented Yet + /* + $domId = $this->app->getPostParam("domainId"); + $groupId = $this->app->getPostParam("groupId"); - + if(!isset($domId) || !isset($groupId)){ + + } + try{ + + $this->libClass->listCredentials() + + //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); + }*/ } $projects = array(); @@ -758,20 +1382,57 @@ class identity implements Core{ * @return void */ $projects["addProject"] = function(){ + //Todo Parameters Optional + $description = $this->app->getPostParam("description"); + $name = $this->app->getPostParam("name"); + if(!isset($name) || !isset($description)){ + + } + try{ + + $project = $this->libClass->createProject([ + 'description' => $description, + 'enabled' => true, + 'name' => $name + ]); + + //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 projects. * - * @throws [Type] [] - * * @return void */ $projects["listProjects"] = function(){ - + try{ + + $projects = $this->libClass->listProjects(); + + //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); + } } /** @@ -783,7 +1444,28 @@ class identity implements Core{ */ $projects["showProject"] = function(){ + $projId = $this->app->getPostParam("projetId"); + if(!isset($projId)){ + + } + + try{ + + $project = $this->libClass->getProject($projId); + $project->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); + } } /** @@ -794,8 +1476,36 @@ class identity implements Core{ * @return void */ $projects["updateProject"] = function(){ + //Todo Parameters Optionnal + $description = $this->app->getPostParam("description"); + $name = $this->app->getPostParam("name"); + $projId = $this->app->getPostParam("projetId"); + if(!isset($projId) || !isset($name) || !isset($description)){ + + } + try{ + + $project = $this->libClass->getProject($projId); + + $project->enabled = false; + $project->description = $description; + $project->name = $name; + + $project->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); + } } /** @@ -806,8 +1516,29 @@ class identity implements Core{ * @return void */ $projects["deleteProject"] = function(){ + $projId = $this->app->getPostParam("projId"); - + if(!isset($projId)){ + + } + + try{ + + $project = $this->libClass->getProject($projId); + + $project->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); + } } /** @@ -819,7 +1550,30 @@ class identity implements Core{ */ $projects["listRolesProjectUser"] = function(){ + $projId = $this->app->getPostParam("projetId"); + $userId = $this->app->getPostParam("userId"); + if(!isset($projId) || !isset($userId)){ + + } + + try{ + + $project = $this->libClass->getProject($projId); + + $project->listUserRoles(['userId' => $userId]); + + //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); + } } /** @@ -831,7 +1585,34 @@ class identity implements Core{ */ $projects["grantRoleProjectUser"] = function(){ + $projId = $this->app->getPostParam("projId"); + $userId = $this->app->getPostParam("userId"); + $roleId = $this->app->getPostParam("roleId"); + if(!isset($projId) || !isset($userId) || !isset($roleId)){ + + } + + try{ + + $project = $this->libClass->getProject($projId); + + $project->grantUserRole([ + 'userId' => $userId, + 'roleId' => $roleId, + ]); + + //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); + } } /** @@ -842,8 +1623,37 @@ class identity implements Core{ * @return void */ $projects["checkRoleProjectUser"] = function(){ + $projId = $this->app->getPostParam("projetId"); + $userId = $this->app->getPostParam("userId"); + $roleId = $this->app->getPostParam("roleId"); + if(!isset($projId) || !isset($userId) || !isset($roleId)){ + + } + try{ + + $project = $this->libClass->getProject($projId); + + $result = $project->checkUserRole([ + 'userId' => $userId, + 'roleId' => $roleId, + ]); + + /*if (true === $result) { + }*/ + + //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); + } } /** @@ -855,7 +1665,34 @@ class identity implements Core{ */ $projects["revokeRoleProjectUser"] = function(){ + $projId = $this->app->getPostParam("projetId"); + $userId = $this->app->getPostParam("userId"); + $roleId = $this->app->getPostParam("roleId"); + + if(!isset($projId) || !isset($userId) || !isset($roleId)){ + + } + try{ + + $project = $this->libClass->getProject($projId); + + $project->revokeUserRole([ + 'userId' => $userId, + 'roleId' => $roleId, + ]); + + //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); + } } /** @@ -866,8 +1703,32 @@ class identity implements Core{ * @return void */ $projects["listRolesProjectGroup"] = function(){ + + $projId = $this->app->getPostParam("projetId"); + $groupId = $this->app->getPostParam("groupId"); + + + if(!isset($projId) || !isset($groupId)){ + + } - + try{ + + $project = $this->libClass->getProject($projId); + + $project->listGroupRoles(['groupId' => $groupId]); + + //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); + } } /** @@ -878,8 +1739,35 @@ class identity implements Core{ * @return void */ $projects["grantRoleProjectGroup"] = function(){ + + $projId = $this->app->getPostParam("projetId"); + $userId = $this->app->getPostParam("userId"); + $roleId = $this->app->getPostParam("roleId"); + + if(!isset($projId) || !isset($userId) || !isset($roleId)){ + + } - + try{ + + $project = $this->libClass->getProject($projId); + + $project->grantUserRole([ + 'userId' => $userId, + 'roleId' => $roleId, + ]); + + //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); + } } /** @@ -891,7 +1779,36 @@ class identity implements Core{ */ $projects["checkRoleProjectGroup"] = function(){ + $projId = $this->app->getPostParam("projetId"); + $userId = $this->app->getPostParam("userId"); + $roleId = $this->app->getPostParam("roleId"); + if(!isset($projId) || !isset($userId) || !isset($roleId)){ + + } + + try{ + + $project = $this->libClass->getProject($projId); + + $result = $project->checkGroupRole([ + 'groupId' => $groupId, + 'roleId' => $roleId, + ]); + + /*if (true === $result) { + }*/ + //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); + } } /** @@ -903,7 +1820,34 @@ class identity implements Core{ */ $projects["revokeRoleProjectGroup"] = function(){ + $projId = $this->app->getPostParam("projetId"); + $userId = $this->app->getPostParam("userId"); + $roleId = $this->app->getPostParam("roleId"); + + if(!isset($projId) || !isset($userId) || !isset($roleId)){ + + } + try{ + + $project = $this->libClass->getProject($projId); + + $project->revokeGroupRole([ + 'groupId' => $groupId, + 'roleId' => $roleId, + ]); + + //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); + } } $roles = array(); @@ -917,31 +1861,77 @@ class identity implements Core{ */ $roles["addRole"] = function(){ + $name = $this->app->getPostParam("name"); + if(!isset($name)){ + + } + + try{ + + $role = $this->libClass->createRole([ + 'name' => $name, + ]); + + //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); + } } /** * List the different roles * - * @throws [Type] [] - * * @return void */ $roles["listRoles"] = function(){ - - + + try{ + + $roles = $this->libClass->listRoles(); + + //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); + } } /** * @todo * - * @throws [Type] [] - * * @return void */ $roles["listRoleAssignements"] = function(){ - + try{ + + $assignements = $this->libClass->listRoleAssignments(); + + //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); + } } $services = array(); @@ -954,20 +1944,55 @@ class identity implements Core{ * @return void */ $services["addService"] = function(){ + $name = $this->app->getPostParam("name"); + $type = $this->app->getPostParam("type"); + if(!isset($name) || !isset($type)){ + + } + try{ + + $service = $this->libClass->createService([ + 'name' => $name, + 'type' => $type, + ]); + + //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 services. * - * @throws [Type] [] - * * @return void */ $services["listServices"] = function(){ - + try{ + + $services = $this->libClass->listServices(); + + //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); + } } /** @@ -978,8 +2003,27 @@ class identity implements Core{ * @return void */ $services["showService"] = function(){ + $servId = $this->app->getPostParam("serviceId"); + if(!isset($servId)){ + + } + try{ + + $service = $this->libClass->getService($servId); + + //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); + } } /** @@ -991,7 +2035,29 @@ class identity implements Core{ */ $services["deleteService"] = function(){ + $servId = $this->app->getPostParam("serviceId"); + $groupId = $this->app->getPostParam("groupId"); + if(!isset($servId) || !isset($groupId)){ + + } + + try{ + + $service = $this->libClass->getService($servId); + $service->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); + } } $tokens = array(); @@ -1005,7 +2071,33 @@ class identity implements Core{ */ $tokens["genTokenUserID"] = function(){ + $userId = $this->app->getPostParam("userId"); + $userPass = $this->app->getPostParam("userPassword"); + + if(!isset($userId) || !isset($userPass)){ + + } + try{ + + $token = $this->libClass->generateToken([ + 'user' => [ + 'id' => $userId, + 'password' => $userPass + ] + ]); + + //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); + } } /** @@ -1016,8 +2108,38 @@ class identity implements Core{ * @return void */ $tokens["genTokenUserName"] = function(){ + $username = $this->app->getPostParam("username"); + $userPass = $this->app->getPostParam("userPassword"); + $domId = $this->app->getPostParam("domainId"); + + if(!isset($userId) || !isset($userPass) || !isset($domId)){ + + } + try{ + + $token = $this->libClass->generateToken([ + 'user' => [ + 'name' => $username, + 'password' => $userPass, + 'domain' => [ + 'id' => $domId + ] + ] + ]); + + //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); + } } /** @@ -1029,7 +2151,31 @@ class identity implements Core{ */ $tokens["geneTokenID"] = function(){ + $tokenId = $this->app->getPostParam("tokenId"); + $projectId = $this->app->getPostParam("projectId"); + + if(!isset($tokenId) || !isset($projectId)){ + + } + try{ + + $token = $this->libClass->generateToken([ + 'tokenId' => $tokenId, + 'scope' => ['project' => ['id' => $projectId]] + ]); + + //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); + } } /** @@ -1041,7 +2187,37 @@ class identity implements Core{ */ $tokens["genTokenScopedProjectID"] = function(){ + $userId = $this->app->getPostParam("userId"); + $userPass = $this->app->getPostParam("userPass"); + $projId = $this->app->getPostParam("projetId"); + + if(!isset($userId) || !isset($projId) || !isset($userPass)){ + + } + try{ + + $token = $this->libClass->generateToken([ + 'user' => [ + 'id' => $userId, + 'password' => $userPass + ], + 'scope' => [ + 'project' => ['id' => $projId] + ] + ]); + + //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); + } } /** @@ -1053,7 +2229,43 @@ class identity implements Core{ */ $tokens["genTokenScopedProjectName"] = function(){ + $userId = $this->app->getPostParam("userId"); + $userPass = $this->app->getPostParam("userPass"); + $projName = $this->app->getPostParam("projetName"); + $domId = $this->app->getPostParam("domId"); + if(!isset($userId) || !isset($projName) || !isset($userPass) || !isset($domId)){ + + } + + try{ + + $token = $this->libClass->generateToken([ + 'user' => [ + 'id' => $userId, + 'password' => $userPass + ], + 'scope' => [ + 'project' => [ + 'name' => $projName, + 'domain' => [ + 'id' => $domId + ] + ] + ] + ]); + + //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); + } } /** @@ -1065,7 +2277,31 @@ class identity implements Core{ */ $tokens["validateToken"] = function(){ + $tokenId = $this->app->getPostParam("tokenId"); + if(!isset($tokenId)){ + + } + + try{ + + $result = $this->libClass->validateToken($tokenId); + + /*if (true === $result) { + // It's valid! + }*/ + + //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); + } } /** @@ -1077,7 +2313,27 @@ class identity implements Core{ */ $tokens["revokeToken"] = function(){ + $tokenId = $this->app->getPostParam("tokenId"); + + if(!isset($tokenId)){ + + } + try{ + + $this->libClass->revokeToken($tokenId); + + //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); + } } $users = array(); @@ -1090,20 +2346,65 @@ class identity implements Core{ * @return void */ $users["addUser"] = function(){ + //Todo Optionnal Parameter + $projId = $this->app->getPostParam("projId"); + $desc = $this->app->getPostParam("description"); + $email = $this->app->getPostParam("email"); + $name = $this->app->getPostParam("name"); + $pass = $this->app->getPostParam("pass"); + $domId = $this->app->getPostParam("domId"); + if(!isset($domId) || !isset($groupId)){ + } + + try{ + + $user = $this->libClass->createUser([ + 'defaultProjectId' => $projId, + 'description' => $desc, + 'domainId' => $domId, + 'email' => $email, + 'enabled' => true, + 'name' => $name, + 'password' => $pass + ]); + + //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 users. * - * @throws [Type] [] - * * @return void */ $users["listUsers"] = function(){ - + try{ + + $users = $this->libClass->listUsers(); + + //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); + } } /** @@ -1115,7 +2416,28 @@ class identity implements Core{ */ $users["showUser"] = function(){ + $userId = $this->app->getPostParam("userId"); + + if(!isset($userId)){ + + } + try{ + + $user = $this->libClass->getUser($userId); + $user->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); + } } /** @@ -1127,7 +2449,34 @@ class identity implements Core{ */ $users["updateUser"] = function(){ + $userId = $this->app->getPostParam("userId"); + $desc = $this->app->getPostParam("description"); + $name = $this->app->getPostParam("name"); + + if(!isset($userId) || !isset($desc) || !isset($name)){ + + } + try{ + + $user = $this->libClass->getUser($userId); + + $user->description = $desc; + $user->name = $name; + + $user->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); + } } /** @@ -1139,7 +2488,28 @@ class identity implements Core{ */ $users["deleteUser"] = function(){ + $userId = $this->app->getPostParam("userId"); + + if(!isset($userId)){ + + } + try{ + + $user = $this->libClass->getUser($userId); + $user->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); + } } /** @@ -1151,7 +2521,29 @@ class identity implements Core{ */ $users["listUserGroups"] = function(){ + $userId = $this->app->getPostParam("userId"); + if(!isset($userId)){ + + } + + try{ + + $user = $this->libClass->getUser($userId); + + $groups = $user->listGroups(); + + //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); + } } /** @@ -1163,7 +2555,29 @@ class identity implements Core{ */ $users["listUserProjects"] = function(){ + $userId = $this->app->getPostParam("userId"); + + if(!isset($userId)){ + + } + try{ + + $user = $this->libClass->getUser($userId); + + $projects = $user->listProjects(); + + //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); + } } $actions["Credentials"] = $credentials; -- 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/Identity.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 From 5ac2313bea3f186acdeeb8594542a3702e3dc305 Mon Sep 17 00:00:00 2001 From: EoleDev Date: Wed, 17 Feb 2016 17:20:38 +0100 Subject: Modification of the Identity's function's implementation, MAJ of the library php-opencloud/openstack --- server/core/Identity.php | 188 +++++++++++++++------------------- server/vendor/php-opencloud/openstack | 2 +- 2 files changed, 84 insertions(+), 106 deletions(-) mode change 100644 => 100755 server/core/Identity.php (limited to 'server/core/Identity.php') diff --git a/server/core/Identity.php b/server/core/Identity.php old mode 100644 new mode 100755 index 00199ec..2638985 --- a/server/core/Identity.php +++ b/server/core/Identity.php @@ -25,9 +25,6 @@ class identity implements Core{ /** @var OpenStack\Identity $libClass protected, contains the library Identity object */ protected $libClass; - - /** @var array $actions protected, contains the functions which can be call by the front-end */ - protected $actions = array(); /** * identity constructor @@ -44,9 +41,19 @@ class identity implements Core{ $this->libClass = $app->getLibClass("Identity"); } - - $credentials = array(); + /** + * Execute an action + * + * @param String $action name of another function of this class + * + * @return void + */ + public function action($action){ + + $this->{$action.""}(); + + } /** * Add a credential for the given user/project. * @@ -60,7 +67,7 @@ class identity implements Core{ * * @return void */ - $credentials["addCredential"] = function(){ + private function addCredential(){ $blob = $this->app->getPostParam("blob"); $projectId = $this->app->getPostParam("projectId"); @@ -96,7 +103,7 @@ class identity implements Core{ * * @return void */ - $credentials["listCredentials"] = function(){ + private function listCredentials(){ try{ $this->libClass->listCredentials() @@ -122,7 +129,7 @@ class identity implements Core{ * * @return void */ - $credentials["showCredential"] = function(){ + private function showCredential(){ $credentId = $this->app->getPostParam("credentialId"); if(!isset($credentId)){ @@ -157,7 +164,7 @@ class identity implements Core{ * * @return void */ - $credentials["updateCredential"] = function(){ + private function updateCredential(){ $credentId = $this->app->getPostParam("credentialId"); $blob = $this->app->getPostParam("blob"); @@ -197,7 +204,7 @@ class identity implements Core{ * * @return void */ - $credentials["deleteCredential"] = function(){ + private function deleteCredential(){ $credentId = $this->app->getPostParam("credentialId"); @@ -223,8 +230,6 @@ class identity implements Core{ } }- - $domains = array(); - /** * Add a domain to an OpenStack instance. * @@ -234,7 +239,7 @@ class identity implements Core{ * * @return void */ - $domains["addDomain"] = function(){ + private function addDomain(){ $description = $this->app->getPostParam("desc"); $enabled = $this->app->getPostParam("enabled"); @@ -277,7 +282,7 @@ class identity implements Core{ * * @return void */ - $domains["listDomains"] = function(){ + private function listDomains(){ try{ @@ -304,7 +309,7 @@ class identity implements Core{ * * @return void */ - $domains["showDomain"] = function(){ + private function showDomain(){ $domId = $this->app->getPostParam("domainId"); @@ -340,7 +345,7 @@ class identity implements Core{ * * @return void */ - $domains["updateDomain"] = function(){ + private function updateDomain(){ $domId = $this->app->getPostParam("domainId"); $description = $this->app->getPostParam("desc"); @@ -386,7 +391,7 @@ class identity implements Core{ * * @return void */ - $domains["deleteDomain"] = function(){ + private function deleteDomain(){ $domId = $this->app->getPostParam("domainId"); @@ -419,7 +424,7 @@ class identity implements Core{ * * @return void */ - $domains["listRolesDomainUser"] = function(){ + private function listRolesDomainUser(){ $domId = $this->app->getPostParam("domainId"); $userId = $this->app->getPostParam("userId"); @@ -454,7 +459,7 @@ class identity implements Core{ * * @return void */ - $domains["grantRoleDomainUser"] = function(){ + private function grantRoleDomainUser(){ $domId = $this->app->getPostParam("domainId"); $roleId = $this->app->getPostParam("roleId"); $userId = $this->app->getPostParam("userId"); @@ -492,7 +497,7 @@ class identity implements Core{ * * @return void */ - $domains["checkRoleDomainUser"] = function(){ + private function checkRoleDomainUser(){ $domId = $this->app->getPostParam("domainId"); $roleId = $this->app->getPostParam("roleId"); $userId = $this->app->getPostParam("userId"); @@ -531,7 +536,7 @@ class identity implements Core{ * * @return void */ - $domains["revokeRoleDomainUser"] = function(){ + private function revokeRoleDomainUser(){ $domId = $this->app->getPostParam("domainId"); $roleId = $this->app->getPostParam("roleId"); $userId = $this->app->getPostParam("userId"); @@ -569,7 +574,7 @@ class identity implements Core{ * * @return void */ - $domains["listRolesDomainGroup"] = function(){ + private function listRolesDomainGroup(){ $domId = $this->app->getPostParam("domainId"); $groupId = $this->app->getPostParam("groupId"); @@ -604,7 +609,7 @@ class identity implements Core{ * * @return void */ - $domains["grantRoleDomainGroup"] = function(){ + private function grantRoleDomainGroup(){ $domId = $this->app->getPostParam("domainId"); $groupId = $this->app->getPostParam("groupId"); $roleId = $this->app->getPostParam("roleId"); @@ -642,7 +647,7 @@ class identity implements Core{ * * @return void */ - $domains["checkRoleDomainGroup"] = function(){ + private function checkRoleDomainGroup(){ $domId = $this->app->getPostParam("domainId"); $groupId = $this->app->getPostParam("groupId"); $roleId = $this->app->getPostParam("roleId"); @@ -687,7 +692,7 @@ class identity implements Core{ * * @return void */ - $domains["revokeRoleDomainGroup"] = function(){ + private function revokeRoleDomainGroup(){ $domId = $this->app->getPostParam("domainId"); $groupId = $this->app->getPostParam("groupId"); $roleId = $this->app->getPostParam("roleId"); @@ -719,8 +724,6 @@ class identity implements Core{ } } - $endpoints = array(); - /** * Add an endpoint to the Openstack instance * @@ -728,7 +731,7 @@ class identity implements Core{ * * @return void */ - $endpoints["addEndpoint"] = function(){ + private function addEndpoint(){ $servId = $this->app->getPostParam("serviceId"); $name = $this->app->getPostParam("name"); $region = $this->app->getPostParam("region"); @@ -768,7 +771,7 @@ class identity implements Core{ * * @return void */ - $endpoints["getEndpoint"] = function(){ + private function getEndpoint(){ $endId = $this->app->getPostParam("endpointId"); @@ -798,7 +801,7 @@ class identity implements Core{ * * @return void */ - $endpoints["listEndpoints"] = function(){ + private function listEndpoints(){ try{ @@ -824,7 +827,7 @@ class identity implements Core{ * * @return void */ - $endpoints["updateEndpoint"] = function(){ + private function updateEndpoint(){ //Not Implemented Yet /*$domId = $this->app->getPostParam("domainId"); @@ -863,7 +866,7 @@ class identity implements Core{ * * @return void */ - $endpoints["deleteEndpoint"] = function(){ + private function deleteEndpoint(){ $endId = $this->app->getPostParam("endpointId"); if(!isset($endId)){ @@ -888,8 +891,6 @@ class identity implements Core{ } } - $groups = array(); - /** * Add a group. * @@ -897,7 +898,7 @@ class identity implements Core{ * * @return void */ - $groups["addGroup"] = function(){ + private function addGroup(){ //Not Implemented Yet /*$domId = $this->app->getPostParam("domainId"); @@ -930,7 +931,7 @@ class identity implements Core{ * * @return void */ - $groups["listGroups"] = function(){ + private function listGroups(){ //Not Implemented Yet /* $domId = $this->app->getPostParam("domainId"); @@ -963,7 +964,7 @@ class identity implements Core{ * * @return void */ - $groups["showGroup"] = function(){ + private function showGroup(){ //Not Implemented Yet /* @@ -997,7 +998,7 @@ class identity implements Core{ * * @return void */ - $groups["updateGroup"] = function(){ + private function updateGroup(){ //Todo Argument Optional $groupId = $this->app->getPostParam("groupId"); $description = $this->app->getPostParam("description"); @@ -1038,7 +1039,7 @@ class identity implements Core{ * * @return void */ - $groups["deleteGroup"] = function(){ + private function deleteGroup(){ $groupId = $this->app->getPostParam("groupId"); @@ -1072,7 +1073,7 @@ class identity implements Core{ * * @return void */ - $groups["listGroupUsers"] = function(){ + private function listGroupUsers(){ $groupId = $this->app->getPostParam("groupId"); @@ -1106,7 +1107,7 @@ class identity implements Core{ * * @return void */ - $groups["addGroupUser"] = function(){ + private function addGroupUser(){ $userId = $this->app->getPostParam("userId"); $groupId = $this->app->getPostParam("groupId"); @@ -1141,7 +1142,7 @@ class identity implements Core{ * * @return void */ - $groups["removeGroupUser"] = function(){ + private function removeGroupUser(){ $userId = $this->app->getPostParam("userId"); $groupId = $this->app->getPostParam("groupId"); @@ -1176,7 +1177,7 @@ class identity implements Core{ * * @return void */ - $groups["checkGroupUser"] = function(){ + private function checkGroupUser(){ $userId = $this->app->getPostParam("userId"); $groupId = $this->app->getPostParam("groupId"); @@ -1204,8 +1205,6 @@ class identity implements Core{ } } - $policies = array(); - /** * @todo * @@ -1213,7 +1212,7 @@ class identity implements Core{ * * @return void */ - $policies["addPolicies"] = function(){ + private function addPolicies(){ //Not Implemented Yet /* $domId = $this->app->getPostParam("domainId"); @@ -1246,7 +1245,7 @@ class identity implements Core{ * * @return void */ - $policies["listPolicies"] = function(){ + private function listPolicies(){ //Not Implemented Yet /* $domId = $this->app->getPostParam("domainId"); @@ -1279,7 +1278,7 @@ class identity implements Core{ * * @return void */ - $policies["showPolicie"] = function(){ + private function showPolicie(){ //Not Implemented Yet /* $domId = $this->app->getPostParam("domainId"); @@ -1313,7 +1312,7 @@ class identity implements Core{ * * @return void */ - $policies["updatePolicies"] = function(){ + private function updatePolicies(){ //Not Implemented Yet /* $domId = $this->app->getPostParam("domainId"); @@ -1346,7 +1345,7 @@ class identity implements Core{ * * @return void */ - $policies["deletePolicies"] = function(){ + private function deletePolicies(){ //Not Implemented Yet /* $domId = $this->app->getPostParam("domainId"); @@ -1372,8 +1371,6 @@ class identity implements Core{ }*/ } - $projects = array(); - /** * Add a project. * @@ -1381,7 +1378,7 @@ class identity implements Core{ * * @return void */ - $projects["addProject"] = function(){ + private function addProject(){ //Todo Parameters Optional $description = $this->app->getPostParam("description"); $name = $this->app->getPostParam("name"); @@ -1416,7 +1413,7 @@ class identity implements Core{ * * @return void */ - $projects["listProjects"] = function(){ + private function listProjects(){ try{ @@ -1442,7 +1439,7 @@ class identity implements Core{ * * @return void */ - $projects["showProject"] = function(){ + private function showProject(){ $projId = $this->app->getPostParam("projetId"); @@ -1475,7 +1472,7 @@ class identity implements Core{ * * @return void */ - $projects["updateProject"] = function(){ + private function updateProject(){ //Todo Parameters Optionnal $description = $this->app->getPostParam("description"); $name = $this->app->getPostParam("name"); @@ -1515,7 +1512,7 @@ class identity implements Core{ * * @return void */ - $projects["deleteProject"] = function(){ + private function deleteProject(){ $projId = $this->app->getPostParam("projId"); if(!isset($projId)){ @@ -1548,7 +1545,7 @@ class identity implements Core{ * * @return void */ - $projects["listRolesProjectUser"] = function(){ + private function listRolesProjectUser(){ $projId = $this->app->getPostParam("projetId"); $userId = $this->app->getPostParam("userId"); @@ -1583,7 +1580,7 @@ class identity implements Core{ * * @return void */ - $projects["grantRoleProjectUser"] = function(){ + private function grantRoleProjectUser(){ $projId = $this->app->getPostParam("projId"); $userId = $this->app->getPostParam("userId"); @@ -1622,7 +1619,7 @@ class identity implements Core{ * * @return void */ - $projects["checkRoleProjectUser"] = function(){ + private function checkRoleProjectUser(){ $projId = $this->app->getPostParam("projetId"); $userId = $this->app->getPostParam("userId"); $roleId = $this->app->getPostParam("roleId"); @@ -1663,7 +1660,7 @@ class identity implements Core{ * * @return void */ - $projects["revokeRoleProjectUser"] = function(){ + private function revokeRoleProjectUser(){ $projId = $this->app->getPostParam("projetId"); $userId = $this->app->getPostParam("userId"); @@ -1702,7 +1699,7 @@ class identity implements Core{ * * @return void */ - $projects["listRolesProjectGroup"] = function(){ + private function listRolesProjectGroup(){ $projId = $this->app->getPostParam("projetId"); $groupId = $this->app->getPostParam("groupId"); @@ -1738,7 +1735,7 @@ class identity implements Core{ * * @return void */ - $projects["grantRoleProjectGroup"] = function(){ + private function grantRoleProjectGroup(){ $projId = $this->app->getPostParam("projetId"); $userId = $this->app->getPostParam("userId"); @@ -1777,7 +1774,7 @@ class identity implements Core{ * * @return void */ - $projects["checkRoleProjectGroup"] = function(){ + private function checkRoleProjectGroup(){ $projId = $this->app->getPostParam("projetId"); $userId = $this->app->getPostParam("userId"); @@ -1818,7 +1815,7 @@ class identity implements Core{ * * @return void */ - $projects["revokeRoleProjectGroup"] = function(){ + private function revokeRoleProjectGroup(){ $projId = $this->app->getPostParam("projetId"); $userId = $this->app->getPostParam("userId"); @@ -1850,8 +1847,6 @@ class identity implements Core{ } } - $roles = array(); - /** * Add a role. * @@ -1859,7 +1854,7 @@ class identity implements Core{ * * @return void */ - $roles["addRole"] = function(){ + private function addRole(){ $name = $this->app->getPostParam("name"); @@ -1891,7 +1886,7 @@ class identity implements Core{ * * @return void */ - $roles["listRoles"] = function(){ + private function listRoles(){ try{ @@ -1915,7 +1910,7 @@ class identity implements Core{ * * @return void */ - $roles["listRoleAssignements"] = function(){ + private function listRoleAssignements(){ try{ @@ -1934,8 +1929,6 @@ class identity implements Core{ } } - $services = array(); - /** * Add a service. * @@ -1943,7 +1936,7 @@ class identity implements Core{ * * @return void */ - $services["addService"] = function(){ + private function addService(){ $name = $this->app->getPostParam("name"); $type = $this->app->getPostParam("type"); @@ -1976,7 +1969,7 @@ class identity implements Core{ * * @return void */ - $services["listServices"] = function(){ + private function listServices(){ try{ @@ -2002,7 +1995,7 @@ class identity implements Core{ * * @return void */ - $services["showService"] = function(){ + private function showService(){ $servId = $this->app->getPostParam("serviceId"); if(!isset($servId)){ @@ -2033,7 +2026,7 @@ class identity implements Core{ * * @return void */ - $services["deleteService"] = function(){ + private function deleteService(){ $servId = $this->app->getPostParam("serviceId"); $groupId = $this->app->getPostParam("groupId"); @@ -2060,8 +2053,6 @@ class identity implements Core{ } } - $tokens = array(); - /** * Generate a new token for a given user id. * @@ -2069,7 +2060,7 @@ class identity implements Core{ * * @return void */ - $tokens["genTokenUserID"] = function(){ + private function genTokenUserID(){ $userId = $this->app->getPostParam("userId"); $userPass = $this->app->getPostParam("userPassword"); @@ -2107,7 +2098,7 @@ class identity implements Core{ * * @return void */ - $tokens["genTokenUserName"] = function(){ + private function genTokenUserName(){ $username = $this->app->getPostParam("username"); $userPass = $this->app->getPostParam("userPassword"); $domId = $this->app->getPostParam("domainId"); @@ -2149,7 +2140,7 @@ class identity implements Core{ * * @return void */ - $tokens["geneTokenID"] = function(){ + private function genTokenID(){ $tokenId = $this->app->getPostParam("tokenId"); $projectId = $this->app->getPostParam("projectId"); @@ -2185,7 +2176,7 @@ class identity implements Core{ * * @return void */ - $tokens["genTokenScopedProjectID"] = function(){ + private function genTokenScopedProjectID(){ $userId = $this->app->getPostParam("userId"); $userPass = $this->app->getPostParam("userPass"); @@ -2227,7 +2218,7 @@ class identity implements Core{ * * @return void */ - $tokens["genTokenScopedProjectName"] = function(){ + private function genTokenScopedProjectName(){ $userId = $this->app->getPostParam("userId"); $userPass = $this->app->getPostParam("userPass"); @@ -2275,7 +2266,7 @@ class identity implements Core{ * * @return void */ - $tokens["validateToken"] = function(){ + private function validateToken(){ $tokenId = $this->app->getPostParam("tokenId"); @@ -2311,7 +2302,7 @@ class identity implements Core{ * * @return void */ - $tokens["revokeToken"] = function(){ + private function revokeToken(){ $tokenId = $this->app->getPostParam("tokenId"); @@ -2336,8 +2327,6 @@ class identity implements Core{ } } - $users = array(); - /** * Add a new user. * @@ -2345,7 +2334,7 @@ class identity implements Core{ * * @return void */ - $users["addUser"] = function(){ + private function addUser(){ //Todo Optionnal Parameter $projId = $this->app->getPostParam("projId"); $desc = $this->app->getPostParam("description"); @@ -2388,7 +2377,7 @@ class identity implements Core{ * * @return void */ - $users["listUsers"] = function(){ + private function listUsers(){ try{ @@ -2414,7 +2403,7 @@ class identity implements Core{ * * @return void */ - $users["showUser"] = function(){ + private function showUser(){ $userId = $this->app->getPostParam("userId"); @@ -2447,7 +2436,7 @@ class identity implements Core{ * * @return void */ - $users["updateUser"] = function(){ + private function updateUser(){ $userId = $this->app->getPostParam("userId"); $desc = $this->app->getPostParam("description"); @@ -2486,7 +2475,7 @@ class identity implements Core{ * * @return void */ - $users["deleteUser"] = function(){ + private function deleteUser(){ $userId = $this->app->getPostParam("userId"); @@ -2519,7 +2508,7 @@ class identity implements Core{ * * @return void */ - $users["listUserGroups"] = function(){ + private function listUserGroups(){ $userId = $this->app->getPostParam("userId"); @@ -2553,7 +2542,7 @@ class identity implements Core{ * * @return void */ - $users["listUserProjects"] = function(){ + private function listUserProjects(){ $userId = $this->app->getPostParam("userId"); @@ -2579,15 +2568,4 @@ class identity implements Core{ $this->app->getErrorInstance->NotImplementedHandler($e); } } - - $actions["Credentials"] = $credentials; - $actions["Domains"] = $domains; - $actions["Endpoints"] = $endpoints; - $actions["Groups"] = $groups; - $actions["Policies"] = $policies; - $actions["Projects"] = $projects; - $actions["Roles"] = $roles; - $actions["Services"] = $services; - $actions["Tokens"] = $tokens; - $actions["Users"] = $users; } 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