This commit is contained in:
manzerbredes 2016-03-28 12:17:43 +02:00
commit 53f65de9d4
88 changed files with 3596 additions and 694 deletions

View file

@ -49,6 +49,12 @@ class genTokenOptions
$stack->push(GuzzleMiddleware::log($options['logger'], $options['messageFormatter']));
}
}
public function checkToken(){
//error_log($this->backup['time'], 0);
//return $this->backup['time'] > time();
return true;
}
public function genIdentityToken(){
$options = $this->optionsGlobal['Common'];
@ -271,6 +277,7 @@ class genTokenOptions
$path = "core/LibOverride/projectTokenData/".$token['saved']["project"]["name"];
//error_log(print_r($path, true), 0);
file_put_contents("core/LibOverride/projectTokenData/".$token['saved']["project"]["name"], serialize($token['saved']));
$this->backup['time'] = $token['time'];
$this->backup["roles"] = $token["roles"];
$this->backup["project"] = $token['saved']["project"]["name"];
$this->backup["user"] = $token["user"];
@ -284,7 +291,7 @@ class genTokenOptions
public function loadBackup($back){
$backup = unserialize($back);
$this->backup['time'] = $backup['time'];
$this->backup["roles"] = $backup["roles"];
$this->backup["project"] = $backup["project"];
$this->backup["user"] = $backup["user"];
@ -300,6 +307,7 @@ class genTokenOptions
}
private function serializeToken($token){
global $config;
$tokenSerialized = [];
$tokenSerialized["token"]["methods"] = serialize($token->methods);
$tokenSerialized["roles"] = [];
@ -343,6 +351,7 @@ class genTokenOptions
$tokenSerialized["user"]["name"] = serialize($token->user->name);
$tokenSerialized["token"]["issued"] = serialize($token->issued);
$tokenSerialized["token"]["id"] = serialize($token->id);
$tokenSerialized['time'] = time()+$config['tokenTime']*60;
return $tokenSerialized;
}
@ -377,6 +386,7 @@ class genTokenOptions
$token->catalog = new Models\Catalog($this->httpClient, $api);
$token->catalog->services = [];
error_log(print_r($Saved["catalog"], true), 0);
foreach($Saved["catalog"] as $key => $service){
$tmp = new Models\Service($this->httpClient, $api);