Skip to content

Commit f10c300

Browse files
committed
slight refactoring
1 parent bcd7b8f commit f10c300

File tree

2 files changed

+1
-25
lines changed

2 files changed

+1
-25
lines changed

lib/Sabre/DAV/Auth/Plugin.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@ class Sabre_DAV_Auth_Plugin extends Sabre_DAV_ServerPlugin {
3838
*/
3939
private $realm;
4040

41-
/**
42-
* userName of currently logged in user
43-
*
44-
* @var string
45-
*/
46-
private $userInfo;
47-
4841
/**
4942
* __construct
5043
*
@@ -74,19 +67,6 @@ public function initialize(Sabre_DAV_Server $server) {
7467

7568
}
7669

77-
/**
78-
* Returns the currently logged in user's information.
79-
*
80-
* This will only be set if authentication was succesful.
81-
*
82-
* @return array|null
83-
*/
84-
public function getUserInfo() {
85-
86-
return $this->authBackend->getCurrentUser();
87-
88-
}
89-
9070
/**
9171
* This method intercepts calls to PROPFIND and similar lookups
9272
*
@@ -98,7 +78,7 @@ public function getUserInfo() {
9878
public function afterGetProperties($href, &$properties) {
9979

10080
if (array_key_exists('{DAV:}current-user-principal', $properties[404])) {
101-
if ($ui = $this->getUserInfo()) {
81+
if ($ui = $this->authBackend->getCurrentUser()) {
10282
$properties[200]['{DAV:}current-user-principal'] = new Sabre_DAV_Property_Principal(Sabre_DAV_Property_Principal::HREF, $ui['uri']);
10383
} else {
10484
$properties[200]['{DAV:}current-user-principal'] = new Sabre_DAV_Property_Principal(Sabre_DAV_Property_Principal::UNAUTHENTICATED);

tests/Sabre/DAV/Auth/PluginTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ function testAuthenticate() {
2424
$fakeServer->addPlugin($plugin);
2525
$fakeServer->broadCastEvent('beforeMethod',array('GET'));
2626

27-
$this->assertEquals(array(
28-
'uri' => 'principals/admin',
29-
), $plugin->getUserInfo());
30-
3127
}
3228

3329
function testCurrentUserPrincipal() {

0 commit comments

Comments
 (0)