Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Fixing admin key for the pydio booster so that a user id is always as…
Browse files Browse the repository at this point in the history
…sociated to it
  • Loading branch information
ghecquet committed Dec 8, 2016
1 parent c3e187b commit 8f6f523
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions core/src/plugins/core.mq/src/MqManager.php
Expand Up @@ -352,15 +352,15 @@ public function clientChannelMethod(ServerRequestInterface $request, ResponseInt

switch ($action) {
case "client_register_channel":

$this->msgExchanger->suscribeToChannel($ctx, $httpVars["channel"], $httpVars["client_id"]);
break;

case "client_unregister_channel":

$this->msgExchanger->unsuscribeFromChannel($ctx, $httpVars["channel"], $httpVars["client_id"]);
break;

case "client_consume_channel":

if (UsersService::usersEnabled()) {
Expand Down Expand Up @@ -473,7 +473,7 @@ public function generateAdminKey($params, $ctx){
$this->getAdminKeyString();
return "SUCCESS: Nothing to do, a pair already exists";
}catch(PydioException $e){
$adminPair = $this->getAdminKeyString(true);
$adminPair = $this->getAdminKeyString($u->getId());
$pairFile = $this->getPluginWorkDir(true)."/apikey";
$r = file_put_contents($pairFile, $adminPair);
if($r === false){
Expand Down Expand Up @@ -510,12 +510,12 @@ public function revokeAdminKey($params, $ctx){
* @throws PydioException
* @return string
*/
protected function getAdminKeyString($createIfNotExists = false, $restrictToIp = ""){
protected function getAdminKeyString($userId = "", $restrictToIp = ""){

if($createIfNotExists){
if($userId != ""){
$adminKey = ApiKeysService::findPairForAdminTask(PYDIO_BOOSTER_TASK_IDENTIFIER);
if($adminKey === null){
$adminKey = ApiKeysService::generatePairForAdminTask(PYDIO_BOOSTER_TASK_IDENTIFIER, "", $restrictToIp);
$adminKey = ApiKeysService::generatePairForAdminTask(PYDIO_BOOSTER_TASK_IDENTIFIER, $userId, $restrictToIp);
}
$adminKeyString = $adminKey["t"].":".$adminKey["p"];
}else{
Expand Down Expand Up @@ -561,5 +561,5 @@ public function switchWorkerOff($params){
public function getWorkerStatus($params){
return "OFF"; //$this->getBoosterManager()->getWorkerStatus($params);
}
}

}

0 comments on commit 8f6f523

Please sign in to comment.