-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add OCS API for sharees list #18234
Add OCS API for sharees list #18234
Conversation
As per specification multiple shareTypes can be passed in $ curl -g -v -u admin "http://localhost:8080/ocs/v1.php/apps/files_sharing/api/v1/sharees?itemType=file&shareType[]=0&shareType[]=1" |
return in_array($sharee['value']['shareWith'], $existingSharees) ? null : $sharee; | ||
}, $potentialSharees); | ||
|
||
return array_filter($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.
why do the array_map first and then the array_filter. Just 1 array_filter with callback should do the trick
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.
right, I just forgot
aef3993
to
9201407
Compare
* @return bool True if the entry is an autocomplete hint, false otherwise | ||
*/ | ||
protected function filterAutocompletion($search, $sharee, $label) { | ||
if ($this->config->getSystemValue('webui-sharing-autocompletion.enabled', true)) { |
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.
36aedee
to
9f85d1e
Compare
$users = array_unique($users); | ||
} else { | ||
// Search in all users | ||
$users_tmp = $this->userManager->searchDisplayName($search); |
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.
Just saying, this is a performance hell, we grab all users and trim the sorted result later.
The problem is our custom sorter does not work on the user/group backend as they can only sort by uid/gid
If user enumeration is disabled, we can change this to a simple check if the group/user exists, but if type hinting is enabled it's 😞
The custom sorter moves results to the beginning of the list, which start with the entered search term. If searchDisplayName()
would support wildcards, we could easily circumvent this, by running two requests:
search*
and 2.*search*
- both with a limit
But for now this seems to be implossible @DeepDiver1975
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 share your concern. This approach can really hurt on huge installations.
But if we want to present merged results like this I do not really see an other option.
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.
Well the old version (ajax.php) did not grab all users. The only disadvantage was, that the sorting was different (uid, gid, instead of starting with searchterm, otherwise sort by label).
I guess there are people which prefer the "nicer" way of sorting.
But I'd say it's not worth the performance troubles. This will make the drop down unusable on installations with a few hundred users/groups.
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.
Perf hell: no thanks!
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.
But lets move this in to allow Clients to implement this feature.
We can work in perf afterwards.
9f85d1e
to
91071f1
Compare
PostgreSQL
|
91071f1
to
3951415
Compare
hmpf, forgot to push... Anyway, rebased and pushed now |
To ensure that pagination is working properly we need to make sure the shares are always in the same order. Sorting is first done by label (catches most instances) If there is a user and a group with the same label we sort by shareType If there are multiple users with the same label we sort those by shareWith
0cd07d4
to
199d1dc
Compare
A new inspection was created. |
Fixed all the points that would result in performance issues or incorrect results |
Why the exact part in the response? Clients know what they requested right. So they can pretty easily find the exact match on their own... |
exact parts are full matches |
looking good 👍 |
code looks good 👍 |
@DeepDiver1975 @rullzer
Fix #18117
Todo
Related/Depending