Skip to content

Commit

Permalink
Handle not logged in users
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <louis@chmn.me>
  • Loading branch information
artonge committed Apr 24, 2023
1 parent ea1abc3 commit da69a6a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/DAV/PropFindPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,18 @@
use Sabre\DAV\ServerPlugin;

class PropFindPlugin extends ServerPlugin {
private Folder $userFolder;
private ?Folder $userFolder;

public const MOUNT_POINT_PROPERTYNAME = '{http://nextcloud.org/ns}mount-point';
public const GROUP_FOLDER_ID_PROPERTYNAME = '{http://nextcloud.org/ns}group-folder-id';

public function __construct(IRootFolder $rootFolder, IUserSession $userSession) {
$this->userFolder = $rootFolder->getUserFolder($userSession->getUser()->getUID());
$user = $userSession->getUser();
if ($user === null) {
return;
}

$this->userFolder = $rootFolder->getUserFolder($user->getUID());
}


Expand All @@ -51,6 +56,10 @@ public function initialize(Server $server): void {
}

public function propFind(PropFind $propFind, INode $node): void {
if ($this->userFolder === null) {
return;
}

if ($node instanceof GroupFolderNode) {
$propFind->handle(
self::MOUNT_POINT_PROPERTYNAME,
Expand Down

0 comments on commit da69a6a

Please sign in to comment.