summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rwxr-xr-xserver/Test/AppTestClass.php73
-rwxr-xr-xserver/Test/InitTest.php30
-rw-r--r--server/Test/genTokenOptionsTest.php6
-rw-r--r--server/Test/imageTests.php (renamed from server/test.php)16
-rw-r--r--server/core/App.php45
-rwxr-xr-xserver/core/ErrorManagement.php39
-rw-r--r--server/core/Identity.php1824
-rw-r--r--server/core/Image.php55
m---------server/vendor/php-opencloud/openstack0
9 files changed, 1969 insertions, 119 deletions
diff --git a/server/Test/AppTestClass.php b/server/Test/AppTestClass.php
new file mode 100755
index 0000000..311b9bf
--- /dev/null
+++ b/server/Test/AppTestClass.php
@@ -0,0 +1,73 @@
+<?php
+include_once("../core/Plugin_Api.php");
+include_once("../core/LibOverride/genTokenOptions.php");
+
+class AppTest{
+
+ protected $openstack;
+ protected $pluginsApi;
+ protected $tokenClass;
+ protected $tokenPost;
+ protected $output;
+
+ public function __construct($args){
+
+ $this->tokenPost = NULL;
+ $this->tokenClass = new genTokenOptions($args);
+ $this->openstack = new OpenStack\OpenStack([]);
+ $this->pluginsApi = plugin_api::getInstance();
+ $this->output = array();
+
+ }
+
+ public function setToken($token){
+
+ $this->tokenPost = $token;
+ $this->tokenClass->loadBackup($his->tokenPost);
+
+ }
+
+ public function getLibClass($service){
+
+ switch($service){
+ case "Identity":
+ if($this->tokenPost == NULL) $this->tokenClass->genIdentityToken();
+ $opt = $this->tokenClass->getOptions($service);
+ return $this->openstack->identityV3($opt);
+ break;
+ case "Image":
+ if($this->tokenPost == NULL) $this->tokenClass->genImageToken();
+ $opt = $this->tokenClass->getOptions($service);
+ return $this->openstack->imagesV2($opt);
+ break;
+ }
+
+ }
+
+ public function authenticate(){
+
+ try{
+ $this->tokenClass->genIdentityToken();
+ $this->tokenClass->genComputeToken();
+ $this->tokenClass->genImageToken();
+ $this->tokenClass->genNetworkToken();
+
+ $this->setOutput("token", $this->tokenClass->getBackup());
+ }catch(Exception $e){
+ echo $e;
+ exit();
+ }
+
+ }
+
+ public function setOutput($key, $out){
+
+ $this->output[$key] = $out;
+
+ }
+
+ public function show(){
+ echo json_encode($this->output);
+ }
+
+} \ No newline at end of file
diff --git a/server/Test/InitTest.php b/server/Test/InitTest.php
new file mode 100755
index 0000000..ab90864
--- /dev/null
+++ b/server/Test/InitTest.php
@@ -0,0 +1,30 @@
+<?php
+ require '../vendor/autoload.php';
+ include_once("../config.inc.php");
+ include_once("AppTestClass.php");
+
+
+ $user = "demo";
+ $password = "demopass";
+ $project = "demo";
+
+ $Args = Array(
+ "user" => Array(
+ "name" => $user,
+ "password" => $password,
+ "domain" => Array(
+ "name" => "Default")
+ ),
+ "scope" => Array(
+ "project" => Array(
+ "name" => $project,
+ "domain" => Array(
+ "name" => "Default")
+ )
+ ),
+ "authUrl" => $config["urlAuth"]
+ );
+
+ $App = new AppTest($Args);
+
+?>
diff --git a/server/Test/genTokenOptionsTest.php b/server/Test/genTokenOptionsTest.php
index 54c22d2..f7d0ee4 100644
--- a/server/Test/genTokenOptionsTest.php
+++ b/server/Test/genTokenOptionsTest.php
@@ -1,8 +1,8 @@
<?php
- include_once("../config.inc.php");
+ include_once("config.inc.php");
require "../vendor/autoload.php";
- include_once("../core/Plugin_Api.php");
- include_once("../core/LibOverride/genTokenOptions.php");
+ include_once("core/Plugin_Api.php");
+ include_once("core/LibOverride/genTokenOptions.php");
$user = "admin";
$password = "ae5or6cn";
diff --git a/server/test.php b/server/Test/imageTests.php
index f0e68c4..94ff7b6 100644
--- a/server/test.php
+++ b/server/Test/imageTests.php
@@ -1,9 +1,8 @@
<?php
-ini_set('display_errors', 1);
-date_default_timezone_set("Europe/Paris");
-require 'vendor/autoload.php';
-include("core/Image.php");
-
+require '../vendor/autoload.php';
+include('/istic-openstack/server/init.php');
+
+/*
$options = Array();
$options["user"] = Array("name"=>"admin", "password"=>"ae5or6cn", "domain"=>["id"=>"Default"]);
$options["scope"] = Array("project"=>Array("name"=>"admin", "domain"=>["id"=>"Default"]));
@@ -30,11 +29,9 @@ $openstack = new OpenStack\OpenStack($options);
//$image= $openstack->imagesV2(["region" => "RegionOne"]);
//var_dump($compute->client);
//$servers = $compute->listServers(true);
+echo 'toto';
-// Initialisation Image()
-$optImage = Array();
-$optImage["region"] = "RegionOne";
-$image = new Image($openstack, $optImage);
+$image = new Image($App);
$opt = Array();
$opt['name'] = "Test";
@@ -48,6 +45,7 @@ $opt['minRam'] = 10;
//$new_image = $image->create_image($opt);
+
//Liste des images
$images = $image->list_images();
diff --git a/server/core/App.php b/server/core/App.php
index dafdaad..babb3d9 100644
--- a/server/core/App.php
+++ b/server/core/App.php
@@ -1,13 +1,21 @@
<?php
include_once("core/Plugin_Api.php");
include_once("core/LibOverride/genTokenOptions.php");
+include_once("core/ErrorManagement.php");
+
+use OpenStack\Common\Error\BadResponseError;
+use OpenStack\Common\Error\BaseError;
+use OpenStack\Common\Error\NotImplementedError;
+use OpenStack\Common\Error\UserInputError;
class App{
protected $openstack;
protected $pluginsApi;
+ protected $postParams;
protected $tokenClass;
protected $tokenPost;
+ protected $errorClass;
protected $output;
public function __construct($args){
@@ -16,7 +24,9 @@ class App{
$this->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;
}
@@ -31,14 +41,14 @@ class App{
switch($service){
case "Identity":
- if($tokenPost == NULL) $tokenClass->genIdentityToken();
- $opt = $tokenClass->getOptions($service);
+ if($this->tokenPost == NULL) $this->tokenClass->genIdentityToken();
+ $opt = $this->tokenClass->getOptions($service);
return $this->openstack->identityV3($opt);
break;
case "Image":
- if($tokenPost == NULL) $tokenClass->genImageToken();
- $opt = $tokenClass->getOptions($service);
- return $this->$openstack->imagesV2($opt);
+ if($this->tokenPost == NULL) $this->tokenClass->genImageToken();
+ $opt = $this->tokenClass->getOptions($service);
+ return $this->openstack->imagesV2($opt);
break;
}
@@ -53,10 +63,21 @@ class App{
$this->tokenClass->genNetworkToken();
$this->setOutput("token", $this->tokenClass->getBackup());
- }catch(Exception $e){
- echo $e;
- exit();
- }
+ }catch(BadResponseError $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);
+ }
+
+ }
+
+ public function getPostParam($name){
+
+ return $this->postParams[$name];
}
@@ -66,6 +87,12 @@ class App{
}
+ 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..6bff61f
--- /dev/null
+++ b/server/core/ErrorManagement.php
@@ -0,0 +1,39 @@
+<?php
+
+use OpenStack\Common\Error\BadResponseError;
+use OpenStack\Common\Error\BaseError;
+use OpenStack\Common\Error\NotImplementedError;
+use OpenStack\Common\Error\UserInputError;
+
+
+Class errorManagement{
+
+ protected $app;
+
+
+ public function __construct($args){
+
+ $this->app = $args;
+
+ }
+
+ public function BaseErrorHandler($error){
+
+ }
+
+ 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){
+
+ }
+
+
+}
+
+?> \ No newline at end of file
diff --git a/server/core/Identity.php b/server/core/Identity.php
index 7b6293c..00199ec 100644
--- 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
@@ -53,123 +53,363 @@ 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 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
*/
$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");
+ return;
+ }
+
+ try{
+
+ $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){
+ $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 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);
+ $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);
+ }
}
/**
* Update a user’s access/secret pair.
*
- * @throws [Type] [<description>]
+ * @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(){
+ $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 = $type;
+ $credential->blob = $blob;
+
+ $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] [<description>]
+ * @param String $credentialId Required credential id to delete
*
* @return void
*/
$credentials["deleteCredential"] = function(){
-
- }
+ $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] [<description>]
+ * @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] [<description>]
- *
* @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] [<description>]
+ * @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] [<description>]
+ * @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] [<description>]
+ * @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);
+ }
}
/**
@@ -181,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);
+ }
}
/**
@@ -192,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);
+ }
}
/**
@@ -204,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);
+ }
}
/**
@@ -216,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);
+ }
}
/**
@@ -228,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);
+ }
}
/**
@@ -240,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);
+ }
}
/**
@@ -252,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);
+ }
}
/**
@@ -270,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();
@@ -284,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);
+ }
}
/**
@@ -297,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] [<description>]
- *
* @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);
+ }
}
/**
@@ -320,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);
+ }*/
}
/**
@@ -332,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();
@@ -346,8 +898,29 @@ 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);
+ }*/
}
/**
@@ -358,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);
+ }*/
}
/**
@@ -370,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);
+ }*/
}
/**
@@ -382,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);
+ }
}
/**
@@ -395,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);
+ }
}
/**
@@ -407,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);
+ }
}
/**
@@ -419,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);
+ }
}
/**
@@ -431,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);
+ }
}
/**
@@ -443,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();
@@ -456,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);
+ }*/
}
/**
@@ -468,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);
+ }*/
}
/**
@@ -480,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);
+ }*/
}
@@ -492,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);
+ }*/
}
/**
@@ -504,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();
@@ -518,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] [<description>]
- *
* @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);
+ }
}
/**
@@ -543,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);
+ }
}
/**
@@ -554,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);
+ }
}
/**
@@ -566,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);
+ }
}
/**
@@ -579,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);
+ }
}
/**
@@ -591,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);
+ }
}
/**
@@ -602,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);
+ }
}
/**
@@ -615,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);
+ }
}
/**
@@ -626,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);
+ }
}
/**
@@ -638,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);
+ }
}
/**
@@ -651,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);
+ }
}
/**
@@ -663,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();
@@ -677,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] [<description>]
- *
* @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] [<description>]
- *
* @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();
@@ -714,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] [<description>]
- *
* @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);
+ }
}
/**
@@ -738,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);
+ }
}
/**
@@ -751,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();
@@ -765,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);
+ }
}
/**
@@ -776,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);
+ }
}
/**
@@ -789,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);
+ }
}
/**
@@ -801,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);
+ }
}
/**
@@ -813,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);
+ }
}
/**
@@ -825,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);
+ }
}
/**
@@ -837,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();
@@ -850,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] [<description>]
- *
* @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);
+ }
}
/**
@@ -875,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);
+ }
}
/**
@@ -887,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);
+ }
}
/**
@@ -899,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);
+ }
}
/**
@@ -911,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);
+ }
}
/**
@@ -923,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;
diff --git a/server/core/Image.php b/server/core/Image.php
index b83d155..3001eea 100644
--- a/server/core/Image.php
+++ b/server/core/Image.php
@@ -1,26 +1,55 @@
<?php
-ini_set('display_errors', 1);
-date_default_timezone_set("Europe/Paris");
-class Image {
+//require 'CoreInterface.php';
+
+/**
+* File containing the Image Class.
+*
+* @version 1.0 Initialisation of this file
+* @since 1.0 Core application's file
+*
+* @author Yogg 'yogg at epsina . com'
+*
+* @todo Complete the functions with errors detection and finish the descriptions
+*/
+
+
+/**
+* Image Class of the back-end application
+*
+* ADD CLASS DESCRIPTION
+*
+*/
+class image{
+ //implements Core
+
+ /** @var App $app protected, contains the main app object */
+ protected $app;
+
+ /** @var OpenStack\Identity $libClass protected, contains the library Identity object */
+ protected $libClass;
- protected $oidentity;
- //protected $plugins;
+ /** @var array $actions protected, contains the functions which can be call by the front-end */
+ protected $actions = array();
+
/**
- * Constructor
+ * Image constructor
*
- * @param $openstack
- *
- * @param $options
+ * @param App $app the main app object
*
- **/
- public function __construct($ostack, $options){ //, $apiP
- $this->oidentity = $ostack->imagesV2($options);
- //$this->plugins = $apiP;
+ * @throws [Type] [<description>]
+ *
+ * @return Image
+ */
+ public function __construct($app){
+ $this->app = $app;
+ $this->libClass = $app->getLibClass("Image");
}
+
+
/**
* Details about an image
*
diff --git a/server/vendor/php-opencloud/openstack b/server/vendor/php-opencloud/openstack
-Subproject 15aca73f423166c7ef8337ba08615c103c66e93
+Subproject 1419eb2e01164bb6b8b837df37724423907352d