Skip to content

Commit dd891e7

Browse files
authored
Merge pull request #36626 from nextcloud/perf/dav-auth-setupfs
2 parents 06f0da6 + 7b413a4 commit dd891e7

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

apps/dav/lib/Connector/Sabre/Auth.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,11 @@ protected function validateUserPass($username, $password) {
104104
if ($this->userSession->isLoggedIn() &&
105105
$this->isDavAuthenticated($this->userSession->getUser()->getUID())
106106
) {
107-
\OC_Util::setupFS($this->userSession->getUser()->getUID());
108107
$this->session->close();
109108
return true;
110109
} else {
111-
\OC_Util::setupFS(); //login hooks may need early access to the filesystem
112110
try {
113111
if ($this->userSession->logClientIn($username, $password, $this->request, $this->throttler)) {
114-
\OC_Util::setupFS($this->userSession->getUser()->getUID());
115112
$this->session->set(self::DAV_AUTHENTICATED, $this->userSession->getUser()->getUID());
116113
$this->session->close();
117114
return true;

apps/dav/tests/unit/Connector/Sabre/AuthTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@ public function testValidateUserPassOfAlreadyDAVAuthenticatedUser(): void {
117117
$user = $this->getMockBuilder(IUser::class)
118118
->disableOriginalConstructor()
119119
->getMock();
120-
$user->expects($this->exactly(2))
120+
$user->expects($this->exactly(1))
121121
->method('getUID')
122122
->willReturn('MyTestUser');
123123
$this->userSession
124124
->expects($this->once())
125125
->method('isLoggedIn')
126126
->willReturn(true);
127127
$this->userSession
128-
->expects($this->exactly(2))
128+
->expects($this->exactly(1))
129129
->method('getUser')
130130
->willReturn($user);
131131
$this->session
@@ -171,15 +171,15 @@ public function testValidateUserPassOfInvalidDAVAuthenticatedUserWithValidPasswo
171171
$user = $this->getMockBuilder(IUser::class)
172172
->disableOriginalConstructor()
173173
->getMock();
174-
$user->expects($this->exactly(3))
174+
$user->expects($this->exactly(2))
175175
->method('getUID')
176176
->willReturn('MyTestUser');
177177
$this->userSession
178178
->expects($this->once())
179179
->method('isLoggedIn')
180180
->willReturn(true);
181181
$this->userSession
182-
->expects($this->exactly(3))
182+
->expects($this->exactly(2))
183183
->method('getUser')
184184
->willReturn($user);
185185
$this->session
@@ -660,11 +660,11 @@ public function testAuthenticateValidCredentials(): void {
660660
$user = $this->getMockBuilder(IUser::class)
661661
->disableOriginalConstructor()
662662
->getMock();
663-
$user->expects($this->exactly(3))
663+
$user->expects($this->exactly(2))
664664
->method('getUID')
665665
->willReturn('MyTestUser');
666666
$this->userSession
667-
->expects($this->exactly(4))
667+
->expects($this->exactly(3))
668668
->method('getUser')
669669
->willReturn($user);
670670
$response = $this->auth->check($server->httpRequest, $server->httpResponse);

0 commit comments

Comments
 (0)