Skip to content

Commit

Permalink
always set userId
Browse files Browse the repository at this point in the history
  • Loading branch information
LinneyS committed Nov 29, 2019
1 parent 4e8bc49 commit ded2ad7
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions controller/callbackcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,13 @@ public function download($doc) {
if ($this->userSession->isLoggedIn()) {
$userId = $this->userSession->getUser()->getUID();
} else {
\OC_Util::tearDownFS();

$userId = $hashData->userId;
$user = $this->userManager->get($userId);
\OC_User::setUserId($userId);

$user = $this->userManager->get($userId);
if (!empty($user)) {
$this->userSession->setUser($user);

\OC_Util::tearDownFS();
\OC_Util::setupFS($userId);
}
}
Expand Down Expand Up @@ -382,27 +382,24 @@ public function track($doc, $users, $key, $status, $url, $token) {
try {
$shareToken = isset($hashData->shareToken) ? $hashData->shareToken : NULL;

\OC_Util::tearDownFS();

// author of the latest changes
$userId = $users[0];
$user = $this->userManager->get($userId);
\OC_User::setUserId($userId);

$user = $this->userManager->get($userId);
if (!empty($user)) {
$this->userSession->setUser($user);

\OC_Util::tearDownFS();
\OC_Util::setupFS($userId);
} else {
if (empty($shareToken)) {
$this->logger->debug("Track without token: $fileId status $trackerStatus", array("app" => $this->appName));

$callbackUserId = $hashData->userId;
$callbackUser = $this->userManager->get($callbackUserId);

if (!empty($callbackUser)) {
$userId = $callbackUserId;
}
// author of the callback link
$userId = $hashData->userId;
\OC_User::setUserId($userId);
$this->logger->debug("Track for $userId: $fileId status $trackerStatus", array("app" => $this->appName));

\OC_Util::tearDownFS();
if (!empty($userId)) {
$user = $this->userManager->get($userId);
if (!empty($user)) {
\OC_Util::setupFS($userId);
}
} else {
Expand Down

0 comments on commit ded2ad7

Please sign in to comment.