refactor(dav): readability improvements #4225
Open
joshtrichards wants to merge 16 commits intomasterfrom
Open
Conversation
daa3f5f to
4917721
Compare
Signed-off-by: Josh <josh.t.richards@gmail.com>
…rs, simplify code, and improve docs Improved readability and maintainability: added type hints, made error messages consistent, simplified code by removing unnecessary storage checks and redundant logic, clarified documentation, and aligned implementation with Nextcloud conventions. Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
- Minor docblock imporvements - Extract mount path calculation to dedicated method Signed-off-by: Josh <josh.t.richards@gmail.com>
Added TODO comments to log silent edge cases Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Refactor user property to be readonly and initialize in constructor. Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
And update variable names for clarity and consistency throughout. Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
moved details to private method docblocks Signed-off-by: Josh <josh.t.richards@gmail.com>
4917721 to
a0c1dab
Compare
Signed-off-by: Josh <josh.t.richards@gmail.com>
come-nc
reviewed
Jan 8, 2026
Comment on lines
-92
to
-96
| $storageId = $this->rootFolder->getMountPoint()->getNumericStorageId(); | ||
| if ($storageId === null) { | ||
| return []; | ||
| } | ||
|
|
Contributor
There was a problem hiding this comment.
Can you detail why this check was not needed?
lib/DAV/ACLPlugin.php
Outdated
Comment on lines
235
to
249
| function (array $rawRules) use ($path): bool { | ||
| $node = $this->server->tree->getNodeForPath($path); | ||
| if (!$node instanceof Node) { | ||
| return false; | ||
| } | ||
|
|
||
| $fileInfo = $node->getFileInfo(); | ||
| $mount = $fileInfo->getMountPoint(); | ||
| if (!$mount instanceof GroupMountPoint) { | ||
| return false; | ||
| } | ||
|
|
||
| if ($this->user === null) { | ||
| return false; | ||
| } |
lib/DAV/ACLPlugin.php
Outdated
Comment on lines
205
to
208
| ksort($rulesByPath); // Ensure parent paths are applied from root down | ||
| $inheritedPermissionsByUserKey = []; // Effective permissions per mapping | ||
| $inheritedMaskByUserKey = []; // Combined permission masks per mapping | ||
| $userMappingsByKey = []; // Mapping reference for later rule creation |
Contributor
There was a problem hiding this comment.
Not sure whether that’s officially part of our code style but I prefer the comment on its own line before the code, and not inline at the end of the line.
Contributor
|
Overall looks good but rebase and conflict fixing is needed. |
icewind1991
requested changes
Jan 9, 2026
| private function getFolder(string $name): ?FolderDefinition { | ||
| $folders = $this->folderManager->getFoldersForUser($this->user); | ||
| foreach ($folders as $folder) { | ||
| if (basename($folder->mountPoint) === $name) { |
Member
There was a problem hiding this comment.
this is incorrect, as a user can have both Bar/Foo and Foo groupfolders
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces less implementation changes than it may appear. Most of the diff is due to formatting changes, variable renaming, and factoring existing code into new private methods.
The overall goal:
Refactor code for better readability and future maintainability.
Key areas of change
Details by Component
RootCollection
PropFindPlugin
readonlyinitialize()for Sabre plugin consistencyMOUNT_POINT_PROPERTYNAMElogic into a private methodGroupFoldersHome
GroupFolderNode
ACLPlugin
Other:
TODO: