perf(dav): Do not call general setupFS on ever dav auth

Signed-off-by: Julius Härtl <jus@bitgrid.net>
pull/36626/head
Julius Härtl 2023-02-09 08:48:07 +07:00
parent c10317f7f9
commit 7b413a41eb
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
2 changed files with 6 additions and 9 deletions

@ -104,14 +104,11 @@ class Auth extends AbstractBasic {
if ($this->userSession->isLoggedIn() &&
$this->isDavAuthenticated($this->userSession->getUser()->getUID())
) {
\OC_Util::setupFS($this->userSession->getUser()->getUID());
$this->session->close();
return true;
} else {
\OC_Util::setupFS(); //login hooks may need early access to the filesystem
try {
if ($this->userSession->logClientIn($username, $password, $this->request, $this->throttler)) {
\OC_Util::setupFS($this->userSession->getUser()->getUID());
$this->session->set(self::DAV_AUTHENTICATED, $this->userSession->getUser()->getUID());
$this->session->close();
return true;

@ -117,7 +117,7 @@ class AuthTest extends TestCase {
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->exactly(2))
$user->expects($this->exactly(1))
->method('getUID')
->willReturn('MyTestUser');
$this->userSession
@ -125,7 +125,7 @@ class AuthTest extends TestCase {
->method('isLoggedIn')
->willReturn(true);
$this->userSession
->expects($this->exactly(2))
->expects($this->exactly(1))
->method('getUser')
->willReturn($user);
$this->session
@ -171,7 +171,7 @@ class AuthTest extends TestCase {
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->exactly(3))
$user->expects($this->exactly(2))
->method('getUID')
->willReturn('MyTestUser');
$this->userSession
@ -179,7 +179,7 @@ class AuthTest extends TestCase {
->method('isLoggedIn')
->willReturn(true);
$this->userSession
->expects($this->exactly(3))
->expects($this->exactly(2))
->method('getUser')
->willReturn($user);
$this->session
@ -660,11 +660,11 @@ class AuthTest extends TestCase {
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->exactly(3))
$user->expects($this->exactly(2))
->method('getUID')
->willReturn('MyTestUser');
$this->userSession
->expects($this->exactly(4))
->expects($this->exactly(3))
->method('getUser')
->willReturn($user);
$response = $this->auth->check($server->httpRequest, $server->httpResponse);