-
Notifications
You must be signed in to change notification settings - Fork 97
refactor(dav): readability improvements #4225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
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>
| $storageId = $this->rootFolder->getMountPoint()->getNumericStorageId(); | ||
| if ($storageId === null) { | ||
| return []; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you detail why this check was not needed?
lib/DAV/ACLPlugin.php
Outdated
| 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; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is all this removed?
lib/DAV/ACLPlugin.php
Outdated
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
|
Overall looks good but rebase and conflict fixing is needed. |
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: