diff --git a/client/index.html b/client/index.html
index a4845e8..013b1b4 100644
--- a/client/index.html
+++ b/client/index.html
@@ -71,6 +71,9 @@
+
+
+
@@ -79,7 +82,8 @@
-
+
+
diff --git a/client/js/app.js b/client/js/app.js
index 0e9c423..90fae89 100644
--- a/client/js/app.js
+++ b/client/js/app.js
@@ -1,9 +1,16 @@
-// Declare main app
+/**
+ * The main app module instance
+ * @type angular.module.angular-1_3_6_L1749.moduleInstance
+ */
var mainApp=angular.module("mainApp",['ngRoute', 'ngSanitize']);
-
+/**
+ * Configure routeProvider
+ */
mainApp.config(['$routeProvider', function($routeProvider){
+
+
$routeProvider.
when('/home',{
templateUrl: 'partials/home/main.html',
@@ -15,4 +22,13 @@ mainApp.config(['$routeProvider', function($routeProvider){
}).otherwise({
redirectTo: '/home'
});
-}]);
\ No newline at end of file
+}]);
+
+/**
+ * Configure httpProvider
+ */
+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/home/main.js b/client/js/controllers/home/main.js
index 2898de2..e629779 100644
--- a/client/js/controllers/home/main.js
+++ b/client/js/controllers/home/main.js
@@ -1,9 +1,8 @@
-/*
- * home Controller
+/**
+ * The home controller
+ *
+ * @param {$scope} $scope The $scope service from angular
*/
-
-
-
mainApp.controller('homeCtrl', function ($scope)
{
diff --git a/client/js/controllers/login.js b/client/js/controllers/login.js
index 2f74414..751bd09 100644
--- a/client/js/controllers/login.js
+++ b/client/js/controllers/login.js
@@ -1,39 +1,60 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
/**
- * Represents a book.
- * @constructor
+ * The login controler
+ * @param {$scope} $scope The $scope angular service
+ * @param {$sce} $sce The $sce angular service
+ * @param {$http} $http The $http angular service
+ * @param {sharedProfile} sharedProfile The sharedProfile service
+
*/
-mainApp.controller('loginCtrl', function ($scope,$interval,$sce)
+mainApp.controller('loginCtrl', ['$scope','$sce','$http', 'sharedProfile', function ($scope,$sce, $http, sharedProfile)
{
- // Define default states
- $('#loginModal').modal({backdrop: 'static', keyboard: false});
- $('#loadingLoginButton').hide();
- $('#failedToLoginAlert').hide();
+ // Define default states
+ $('#loginModal').modal({backdrop: 'static', keyboard: false});
+ $('#loadingLoginButton').hide();
+ $('#failedToLoginAlert').hide();
+
-
- $('#loginButton').click(function(){
+ $('#loginButton').click(function(){
$('#loginButton').hide();
$('#loadingLoginButton').show();
$('#failedToLoginAlert').hide();
+ var username=$("#loginFormUsername").val();
+ var password=$("#loginFormPassword").val();
+ var projectname=$("#loginFormProjectname").val();
+
+ var result=identity.request.login($http,username, password, projectname);
+
+ result.then(function (response){
+ // Parser result
+ var requestResultObject=identity.requestParser.parseLoginAnswer(response);
+
+ // Check for error
+ if(requestResultObject.status!==0){
+ //alert(result.data)
+ $('#failedToLoginAlert').show();
+ }
+ else {
+ $('#loginModal').modal('hide');
+ sharedProfile.username=username;
+ sharedProfile.projectname=projectname;
- $interval(
- function()
- {
- $('#failedToLoginAlert').show();
+ }
+ // Reset button state
$('#loginButton').show();
- $('#loadingLoginButton').hide();
-
- }, 2000,1);
-
+ $('#loadingLoginButton').hide();
+ },function(response){
+ $('#failedToLoginAlert').show();
+ // Reset button state
+ $('#loginButton').show();
+ $('#loadingLoginButton').hide();
+ });
+
+
});
-})
+}]);
diff --git a/client/js/controllers/network/main.js b/client/js/controllers/network/main.js
index 6c916ae..7264aec 100644
--- a/client/js/controllers/network/main.js
+++ b/client/js/controllers/network/main.js
@@ -1,9 +1,8 @@
-/*
- * network Controller
+/**
+ * The network controller
+ *
+ * @param {$scope} $scope The $scope service from angular
*/
-
-
-
mainApp.controller('networkCtrl', function ($scope)
{
});
\ No newline at end of file
diff --git a/client/js/controllers/status.js b/client/js/controllers/status.js
index 42a54d4..ce6882e 100644
--- a/client/js/controllers/status.js
+++ b/client/js/controllers/status.js
@@ -1,28 +1,14 @@
-/*
- * mainApp Controller
+
+
+/**
+ * The status controller
+ *
+ * @param {$scope} $scope The $scope service from angular
+ * @param {sharedProfile} sharedProfile The sharedProfile build by ourself
*/
-
-
-
-mainApp.controller('statusCtrl', function ($scope,$interval,$sce)
+mainApp.controller('statusCtrl', ['$scope','sharedProfile', function ($scope, sharedProfile)
{
- $scope.username="John Doe";
- $scope.projectname="Web Server";
- // Update status every 2 seconds
- /*$interval(function(){
- var status=identity.fetchStatus();
- $scope.username=status[1];
- $scope.lastconnection=status[2];
- if(status[0] == "1"){
- $scope.connection=$sce.trustAsHtml("Online");
- }
- else{
- $scope.connection=$sce.trustAsHtml("Offline");
- }
- }, 2000);*/
-
-
-
+ $scope.profile=sharedProfile;
+
-
-});
\ No newline at end of file
+}]);
\ No newline at end of file
diff --git a/client/js/requests/identity.js b/client/js/requests/identity.js
index cad1261..be3f4f8 100644
--- a/client/js/requests/identity.js
+++ b/client/js/requests/identity.js
@@ -1,42 +1,52 @@
-// Make Namespace
-var identity = {} ;
+/**
+ * Client Identity Module
+ * @namespace identity
+ */
+var identity = {};
+
+/**
+ * Contain all request who can be send with http request
+ * @namespace request
+ */
+identity.request = {};
+
+/**
+ * Contain parser for result of request made by {@link identity.request}
+ * @namespace request
+ */
+identity.requestParser = {};
+/**
+ *
+ * @param {object} $http Angular $http service
+ * @param {string} username The user name
+ * @param {string} password The user password
+ * @param {string} projectname The user project name
+ * @returns {promise} The result of the request
+ */
+identity.request.login=function($http,username, password,projectname){
+ return $http.post('../server/index.php',
+ $.param({"task" : "Authenticate", "user" : username, "password" : password, "project" : projectname}));
+};
-
-
-/*
-mainApp.controller('identityCtrl', function($scope, $http) {
-
- $scope.identityFormData = {};
-
- $scope.processForm = function() {
-
- $http({
- method : 'POST',
- url : 'http://148.60.11.31/',
- data : $.param($scope.identityFormData),
- headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
- })
- .success(function(data) {
- console.log(data);
-
- if (!data.success) {
- // if not successful, bind errors to error variables
- //$scope.errorName = data.errors.name;
- //$scope.errorSuperhero = data.errors.superheroAlias;
- } else {
- // if successful, bind success message to message
- //$scope.message = data.message;
- }
- });
- };
-
-
-
-});*/
+/**
+ *
+ * @param {string} response The response to parse
+ * @returns {requestParserResult} Formated data
+ */
+identity.requestParser.parseLoginAnswer=function(response){
+ var requestParserResult={};
-
+ requestParserResult.status=0;
+ requestParserResult.data=response.data;
+
+
+ // TODO
+
+
+ return requestParserResult;
+};
diff --git a/client/js/services/sharedProfile.js b/client/js/services/sharedProfile.js
new file mode 100644
index 0000000..6e78cf6
--- /dev/null
+++ b/client/js/services/sharedProfile.js
@@ -0,0 +1,13 @@
+
+/**
+ * The sharedProfile service
+ * It's used to shared the profile between controller
+ */
+mainApp.factory('sharedProfile',[function(){
+ var profile={};
+
+ profile.username="None";
+ profile.projectname="None";
+
+ return profile;
+}]);
\ No newline at end of file
diff --git a/client/partials/login.html b/client/partials/login.html
index 387b075..e0ce876 100644
--- a/client/partials/login.html
+++ b/client/partials/login.html
@@ -12,18 +12,18 @@
-
- User
+
-
-
+
+
-
- Password
+
diff --git a/client/partials/nav.html b/client/partials/nav.html
index f412597..786c53b 100644
--- a/client/partials/nav.html
+++ b/client/partials/nav.html
@@ -18,8 +18,8 @@
- - User : {{ username }}
- - Project Name : {{ projectname }}
+ - User : {{ profile.username }}
+ - Project Name : {{ profile.projectname }}
diff --git a/server/core/App.php b/server/core/App.php
new file mode 100755
index 0000000..45f6922
--- /dev/null
+++ b/server/core/App.php
@@ -0,0 +1,68 @@
+tokenPost = NULL;
+ $this->tokenClass = new genTokenOptions($args);
+ $this->openstack = new OpenStack\OpenStack([]);
+ $this->pluginsApi = plugin_api::getInstance();
+ $this->output = array();
+
+ }
+
+ public function setToken($token){
+
+ $this->tokenPost = $token;
+ $this->tokenClass->loadBackup($his->tokenPost);
+
+ }
+
+ public function getLibClass($service){
+
+ switch($service){
+ case "Identity":
+ if($tokenPost == NULL) $tokenClass->genIdentityToken();
+ $opt = $tokenClass->getOptions($service);
+ return $this->openstack->identityV3($opt);
+ break;
+ }
+
+ }
+
+ public function authenticate(){
+
+ try{
+ $this->tokenClass->genIdentityToken();
+ $this->tokenClass->genComputeToken();
+ $this->tokenClass->genImageToken();
+ $this->tokenClass->genNetworkToken();
+
+ $this->setOutput("token", $this->tokenClass->getBackup());
+ }catch(Exception $e){
+ echo $e;
+ exit();
+ }
+
+ }
+
+ public function setOutput($key, $out){
+
+ $this->output[$key] = $out;
+
+ }
+
+ public function show(){
+ echo json_encode($this->output);
+ }
+
+}
\ No newline at end of file
diff --git a/server/core/CoreInterface.php b/server/core/CoreInterface.php
new file mode 100755
index 0000000..ed0d959
--- /dev/null
+++ b/server/core/CoreInterface.php
@@ -0,0 +1,7 @@
+]
+ *
+ * @return identity
+ */
+ public function __construct($app){
- public function __construct($ostack, $apiP){
+ $this->app = $app;
+ $this->libClass = $app->getLibClass("Identity");
- $this->oidentity = $ostack->identityV3();
- $this->plugins = $apiP;
-
- }
-
- public function genToken(){
- global $Args;
- $token = $this->oidentity->generateToken($Args);
- return $token;
}
+
+ $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(){
+
+
+ }
+
+ /**
+ * 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;
}
diff --git a/server/core/LibOverride/genTokenOptions.php b/server/core/LibOverride/genTokenOptions.php
index 81ecfc8..58b87c1 100755
--- a/server/core/LibOverride/genTokenOptions.php
+++ b/server/core/LibOverride/genTokenOptions.php
@@ -81,7 +81,7 @@ class genTokenOptions
$options['catalogType'] = 'false';
$options['region'] = 'RegionOne';
- $this->backup['Identity'] = unserialize($opt);
+ $this->backup['Identity'] = $opt;
$token = $this->unserializeToken($this->backup['Identity']['token']);
$baseUrl = $this->backup['Identity']['baseUrl'];
@@ -129,7 +129,7 @@ class genTokenOptions
$options['catalogType'] = 'image';
$options['region'] = 'RegionOne';
- $this->backup['Image'] = unserialize($opt);
+ $this->backup['Image'] = $opt;
$token = $this->unserializeToken($this->backup['Image']['token']);
$baseUrl = $this->backup['Image']['baseUrl'];
@@ -176,7 +176,7 @@ class genTokenOptions
$options['catalogType'] = 'network';
$options['region'] = 'RegionOne';
- $this->backup['Network'] = unserialize($opt);
+ $this->backup['Network'] = $opt;
$token = $this->unserializeToken($this->backup['Network']['token']);
$baseUrl = $this->backup['Network']['baseUrl'];
@@ -224,7 +224,7 @@ class genTokenOptions
$options['catalogType'] = 'compute';
$options['region'] = 'RegionOne';
- $this->backup['Compute'] = unserialize($opt);
+ $this->backup['Compute'] = $opt;
$token = $this->unserializeToken($this->backup['Compute']['token']);
$baseUrl = $this->backup['Compute']['baseUrl'];
@@ -242,8 +242,18 @@ class genTokenOptions
$this->optionsGlobal['Compute'] = $options;
}
- public function getBackup($service){
- return serialize($this->backup[$service]);
+ public function getBackup(){
+ return serialize($this->backup);
+ }
+
+ public function loadBackup($back){
+
+ $backup = unserialize($back);
+ loadComputeBackup($backup["Compute"]);
+ loadIdentityBackup($backup["Identity"]);
+ loadImageBackup($backup["Image"]);
+ loadNetworkBackup($backup["Network"]);
+
}
public function getOptions($service){
diff --git a/server/index.php b/server/index.php
index b3c061a..41f77b8 100755
--- a/server/index.php
+++ b/server/index.php
@@ -3,33 +3,29 @@
include_once("config.inc.php");
include_once("init.php");
-// $task = $_POST["task"];
-// $action = $_POST["action"];
-
-
- //$id = new identity($openstack_api, $pluginApi);
-
-// var_dump($id->genToken());
-// $identity = $openstack_api->identityV3($Args);
- //$tmp = $identity->listEndpoints();
- //foreach($tmp as $cred){
-// echo $cred->id." %%%%%% ";
- //}
- //$servers = $compute->listServers(true);
- //var_dump($servers);
- //foreach($servers as $server){
- // echo $server->id." !!!!!!!!! ";
- //}
-
- $tmp = new genTokenOptions($Args);
- $tmp->loadIdentityBackup($identityBack);
- $array = $tmp->getOptions("Identity");
-
- $openstackTest = new OpenStack\OpenStack([]);
- $identityTest = $openstackTest->identityV3($array);
- $domainsTest = $identityTest->listDomains();
- foreach($domainsTest as $domain){
- echo $domain->id." %%%%%% ";
+ if(isset($_POST["task"]) && isset($_POST["action"])){
+ $task = $_POST["task"];
+ $action = $_POST["action"];
+ }else if(isset($_POST["task"]) && $_POST["task"] == "Authenticate"){
+ $task = $_POST["task"];
+ }else{
+ //Gestion Erreur
+ }
+
+ if($task == "Authenticate"){
+
+ $App->authenticate();
+ $App->show();
+
+ }
+
+ switch($task)
+ {
+ case "identity":
+ include_once("core/Identity.php");
+ $identityObject = new identity($App);
+ $identityObject->action($action);
+ $App->show();
+ break;
}
- // var_dump($openstack_api->getBuilderOptions());
diff --git a/server/init.php b/server/init.php
index 2c07947..cf08523 100755
--- a/server/init.php
+++ b/server/init.php
@@ -1,13 +1,15 @@
Array(
- "name" => $user,
- "password" => $password,
- "domain" => Array(
- "name" => "Default")
- ),
- "scope" => Array(
- "project" => Array(
- "name" => $project,
- "domain" => Array(
- "name" => "Default")
- )
- ),
- "authUrl" => $config["urlAuth"]
- );
- } else {
+ } /*else { // Test Backend
$user = "admin";
$password = "ae5or6cn";
$project = "admin";
- $Args = Array(
+ }*/
+
+ $Args = Array(
"user" => Array(
"name" => $user,
"password" => $password,
@@ -52,21 +40,7 @@
),
"authUrl" => $config["urlAuth"]
);
- }
-
- $pluginApi = plugin_api::getInstance();
- //$openstack_api = new OpenStack\OpenStack($Args);
- //$id = new identity($openstack_api, $pluginApi);
-
- //$token = $id->genToken();
-
- $tmp = new genTokenOptions($Args);
- $tmp->genIdentityToken();
- $array = $tmp->getOptions("Identity");
- $openstack_api = new OpenStack\OpenStack([]);
-
- $identityBack = $tmp->getBackup("Identity");
- //file_put_contents("token", serialize($tmp));
+ $App = new App($Args);
?>