-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Show sharees via propfind #14429
Show sharees via propfind #14429
Conversation
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.
too ambiguous maybe
Share::SHARE_TYPE_ROOM | ||
]; | ||
|
||
if ($this->getPath() === "/") { |
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.
or-connect it with the condition in line 303
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.
👍
} | ||
} | ||
} | ||
return implode(', ', $sharees); |
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.
ain't it better return the array and format it where the output is being handled (the callee)? This also only works as long as "," is prohibited as identifier. Further, you have all the types mixed in and identifiers are not unique across those types. → What do you want to achieve eventually?
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.
If I simply return $sharees, I do get that as plain string, e.g. "adminuser1user2".
If you have a better way, please feel free to change it or give me a hint.
I do not "care" as long as the client has a list of userIds of all sharees.
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.
I removed Circle and Rooms, so that now only user, remote user and groups are returned.
40f086b
to
3ff5424
Compare
as discussed on irc, we agreed about not returning grouped by type and and each user, group etc. is inside an id-tag within the appropriate element. |
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.
So I knew this looked familiar.
Because the way this is implemented it won't scale. If you request this property for a user on a share with 200 entries. It will fire off 300 SQL requests.
We should bundle it with https://github.com/nextcloud/server/blob/master/apps/dav/lib/Connector/Sabre/SharesPlugin.php
$path = $userFolder->get($path); | ||
$this->lock($path); | ||
} catch (\OCP\Files\NotFoundException $e) { | ||
throw new OCSNotFoundException($this->l->t('Wrong path, file/folder doesn\'t exist')); |
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.
This should not be here
} catch (\OCP\Files\NotFoundException $e) { | ||
throw new OCSNotFoundException($this->l->t('Wrong path, file/folder doesn\'t exist')); | ||
} catch (LockedException $e) { | ||
throw new OCSNotFoundException($this->l->t('Could not lock path')); |
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.
Same. This is not an OCS endpoint
3ff5424
to
221a8c6
Compare
Bump, can anyone help me here? Or direct me in the right direction? :-) |
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
b7c0bdb
to
b965c79
Compare
b965c79
to
efa0733
Compare
I really would like to have this in. I changed it as good as I can and can help/rewrite if needed. |
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This makes the XML parsing more sane ;) Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Let me fix the tests this evening |
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
Ok so the test require some more work as they were/are not the cleanest. I'll have a look tomorrow. |
Test all look good. Time for reviews. |
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.
All good from my part
Small note. Once we have this we could also enhance the server UI. |
Besides those two remarks it looks good and works |
no camelCase Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
Can you test this please with an admin account:
For some reason the display name of an admin is missing, but it should be at least userId. |
foreach ($this->shares as $share) { | ||
$writer->startElement('{' . self::NS_NEXTCLOUD . '}sharee'); | ||
$writer->writeElement('{' . self::NS_NEXTCLOUD . '}id', $share->getSharedWith()); | ||
$writer->writeElement('{' . self::NS_NEXTCLOUD . '}display-name', $share->getSharedWithDisplayName()); |
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.
$writer->writeElement('{' . self::NS_NEXTCLOUD . '}display-name', $share->getSharedWithDisplayName()); | |
$writer->writeElement('{' . self::NS_NEXTCLOUD . '}display-name', $share->getSharedWithDisplayName() ?? $share->getSharedWith()); |
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.
I wrote a test for android library and there the problem also exists.
It seems that always one of the display names is set to userId.
BUG:
|
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
Bug fixed via latest commit. |
From my side this is ready to get in |
Fixed the failing tests |
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.
Seems to do what its supposed do and webdav compliance wise I'm also happy with it 👍
❗ TODO: once this is merged, change/check OCFileListAdapter: showShareAvatar boolean ❗
Steps to test
<nc:sharees>tobi@http://localhost/nc15</nc:sharees>
<nc:sharees>admin, Tobi Kaminsky</nc:sharees>
<nc:sharees>admin</nc:sharees>
Please note that this shows only the user you have created & shared a file to.
The other way around (receiving a share) is already exists via < owner-id> and < owner-display-name>.
Signed-off-by: tobiasKaminsky tobias@kaminsky.me