Changeset View
Changeset View
Standalone View
Standalone View
src/applications/base/controller/PhabricatorController.php
Show All 29 Lines | public function willBeginExecution() { | ||||
if ($request->getUser()) { | if ($request->getUser()) { | ||||
// NOTE: Unit tests can set a user explicitly. Normal requests are not | // NOTE: Unit tests can set a user explicitly. Normal requests are not | ||||
// permitted to do this. | // permitted to do this. | ||||
PhabricatorTestCase::assertExecutingUnitTests(); | PhabricatorTestCase::assertExecutingUnitTests(); | ||||
$user = $request->getUser(); | $user = $request->getUser(); | ||||
} else { | } else { | ||||
$user = new PhabricatorUser(); | $user = new PhabricatorUser(); | ||||
$phusr = $request->getCookie('phusr'); | |||||
$phsid = $request->getCookie('phsid'); | $phsid = $request->getCookie('phsid'); | ||||
if ($phsid) { | |||||
if (strlen($phusr) && $phsid) { | $session_user = id(new PhabricatorAuthSessionEngine()) | ||||
$info = queryfx_one( | ->loadUserForSession('web', $phsid); | ||||
$user->establishConnection('r'), | if ($session_user) { | ||||
'SELECT u.* FROM %T u JOIN %T s ON u.phid = s.userPHID | $user = $session_user; | ||||
AND s.type LIKE %> AND s.sessionKey = %s', | |||||
$user->getTableName(), | |||||
PhabricatorUser::SESSION_TABLE, | |||||
'web-', | |||||
PhabricatorHash::digest($phsid)); | |||||
if ($info) { | |||||
$user->loadFromArray($info); | |||||
} | } | ||||
} | } | ||||
$request->setUser($user); | $request->setUser($user); | ||||
} | } | ||||
$translation = $user->getTranslation(); | $translation = $user->getTranslation(); | ||||
if ($translation && | if ($translation && | ||||
▲ Show 20 Lines • Show All 357 Lines • Show Last 20 Lines |