istic-openstack/server/init.php

72 lines
1.6 KiB
PHP
Executable file

<?php
include_once("config.inc.php");
include_once("core/Plugin_Api.php");
require "vendor/autoload.php";
include_once("core/LibOverride/genTokenOptions.php");
include_once("core/Identity.php");
//traitement requete, recuperation data
if(isset($_POST["key"])){
//recuperation des donnes sauvegardes
}else if(isset($_POST["user"]) && isset($_POST["password"]) && isset($_POST["project"]) ){
$user = $_POST["user"];
$password = $_POST["password"];
$project = $_POST["project"];
$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"]
);
} else {
$user = "admin";
$password = "ae5or6cn";
$project = "admin";
$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"]
);
}
$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));
?>