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

Commit

Permalink
Browse files Browse the repository at this point in the history
Mq manager was breaking the "guest" access.
  • Loading branch information
cdujeu committed Dec 12, 2013
1 parent 93515f2 commit 10bd8f9
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 21 deletions.
27 changes: 16 additions & 11 deletions core/src/plugins/core.mq/class.MqManager.php
Expand Up @@ -182,17 +182,22 @@ public function clientChannelMethod($action, $httpVars, $fileVars)
$this->msgExchanger->unsuscribeFromChannel($httpVars["channel"], $httpVars["client_id"]);
break;
case "client_consume_channel":
$user = AuthService::getLoggedUser();
if ($user == null) {
//throw new Exception("You must be logged in");
AJXP_XMLWriter::header();
AJXP_XMLWriter::requireAuth();
AJXP_XMLWriter::close();
return;
}
$GROUP_PATH = $user->getGroupPath();
if($GROUP_PATH == null) $GROUP_PATH = false;
$uId = $user->getId();
if(AuthService::usersEnabled()){
$user = AuthService::getLoggedUser();
if ($user == null) {
//throw new Exception("You must be logged in");
AJXP_XMLWriter::header();
AJXP_XMLWriter::requireAuth();
AJXP_XMLWriter::close();
return;
}
$GROUP_PATH = $user->getGroupPath();
if($GROUP_PATH == null) $GROUP_PATH = false;
$uId = $user->getId();
}else{
$GROUP_PATH = '/';
$uId = 'shared';
}
//session_write_close();

$startTime = time();
Expand Down
16 changes: 11 additions & 5 deletions core/src/plugins/mq.serial/class.AJXP_SerialMessageExchanger.php
Expand Up @@ -77,15 +77,21 @@ public function __destruct()
public function suscribeToChannel($channelName, $clientId)
{
$this->loadChannel($channelName, true);
$user = AuthService::getLoggedUser();
if ($user == null) {
throw new Exception("You must be logged in");
if(AuthService::usersEnabled()){
$user = AuthService::getLoggedUser();
if ($user == null) {
throw new Exception("You must be logged in");
}
$GROUP_PATH = $user->getGroupPath();
$USER_ID = $user->getId();
}else{
$GROUP_PATH = '/';
$USER_ID = 'shared';
}
$GROUP_PATH = $user->getGroupPath();
if($GROUP_PATH == null) $GROUP_PATH = false;
$this->channels[$channelName]["CLIENTS"][$clientId] = array(
"ALIVE" => time(),
"USER_ID" => $user->getId(),
"USER_ID" => $USER_ID,
"GROUP_PATH" => $GROUP_PATH
);
foreach ($this->channels[$channelName]["MESSAGES"] as &$object) {
Expand Down
16 changes: 11 additions & 5 deletions core/src/plugins/mq.sql/class.AJXP_SqlMessageExchanger.php
Expand Up @@ -95,15 +95,21 @@ public function __destruct()
public function suscribeToChannel($channelName, $clientId)
{
$this->loadChannel($channelName, true);
$user = AuthService::getLoggedUser();
if ($user == null) {
throw new Exception("You must be logged in");
if(AuthService::usersEnabled()){
$user = AuthService::getLoggedUser();
if ($user == null) {
throw new Exception("You must be logged in");
}
$GROUP_PATH = $user->getGroupPath();
$USER_ID = $user->getId();
}else{
$GROUP_PATH = "/";
$USER_ID = "shared";
}
$GROUP_PATH = $user->getGroupPath();
if($GROUP_PATH == null) $GROUP_PATH = false;
$this->channels[$channelName]["CLIENTS"][$clientId] = array(
"ALIVE" => time(),
"USER_ID" => $user->getId(),
"USER_ID" => $USER_ID,
"GROUP_PATH" => $GROUP_PATH
);
foreach ($this->channels[$channelName]["MESSAGES"] as &$object) {
Expand Down

0 comments on commit 10bd8f9

Please sign in to comment.