diff options
| author | EoleDev <EoleDev@outlook.fr> | 2016-02-12 15:45:25 +0100 |
|---|---|---|
| committer | EoleDev <EoleDev@outlook.fr> | 2016-02-12 15:45:25 +0100 |
| commit | 6960c81a1f2d4f39135e7d8cc5fa32c42e36b21c (patch) | |
| tree | d83768e3ab8a51136a62734b3dbf81dde8d2803a /server/core/Identity.php | |
| parent | 06d229a37ecb64d1777de31d49251239a9d285d1 (diff) | |
Identity Class first function
Diffstat (limited to 'server/core/Identity.php')
| -rwxr-xr-x | server/core/Identity.php | 59 |
1 files changed, 47 insertions, 12 deletions
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] [<description>] + * @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] [<description>] - * * @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] [<description>] + * @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); + } } |
