Skip to content
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

Provision API pagination for subadmins is broken #19964

Closed
rullzer opened this issue Oct 22, 2015 · 11 comments
Closed

Provision API pagination for subadmins is broken #19964

rullzer opened this issue Oct 22, 2015 · 11 comments

Comments

@rullzer
Copy link
Contributor

rullzer commented Oct 22, 2015

Now that we allow subadmins to get the list of users they have access to via the provisioning API we run into issues.

} else if (\OC_SubAdmin::isSubAdmin($user->getUID())) {
$subAdminOfGroups = \OC_SubAdmin::getSubAdminsGroups($user->getUID());
if($offset === null) {
$offset = 0;
}
$users = [];
foreach ($subAdminOfGroups as $group) {
$users = array_merge($users, $this->groupManager->displayNamesInGroup($group, $search));
}
$users = array_slice($users, $offset, $limit);
} else {

As you can see what we do there is for each group the subadmin is a subadmin of we get the list of users. We merge those lists and then slice the array accordingly.

Now this introduces a few issues:

  1. Assume 10 groups with 1000 members each, your system won't be happy
  2. Since we ask the backends to sort it will be hard to write proper pagination test

To solve problem 1 I think we might need to introduce new calls to the groupManager i.e. displayNamesInGroups and then the additional calls all the way down. This will allow us to let the backend handle deduplication (which is most likely can do much more efficiently).

Problem 2 is something different but can be solved with integration tests. Basically we do not quarantee any order on the results. So if we fill the database with random users to query all we need to check is if (when doing pagination) all users get enumerated exactly once.

Tagging for 9.0 since especially problem 1 could be an issue for large installs.

CC: @DeepDiver1975 @tomneedham

@DeepDiver1975
Copy link
Member

Tagging for 9.0 since especially problem 1 could be an issue for large installs.

@rperezb please add tests to the QA plan - THX

@rullzer
Copy link
Contributor Author

rullzer commented Oct 22, 2015

I already made an issue a while back for the displayNamesInGroups: #18418

@PVince81
Copy link
Contributor

@rullzer is that still an issue ?

@rullzer
Copy link
Contributor Author

rullzer commented Feb 12, 2016

yes.

@karlitschek
Copy link
Contributor

Is this really a sev2?

@ghost ghost modified the milestones: 9.1-next, 9.0-current Feb 24, 2016
rullzer added a commit that referenced this issue May 24, 2016
@PVince81
Copy link
Contributor

PVince81 commented Jun 1, 2016

Moving to 9.2 as per PR

@PVince81 PVince81 modified the milestones: 9.2-next, 9.1-current Jun 1, 2016
@PVince81 PVince81 assigned tomneedham and unassigned rullzer Jan 13, 2017
@PVince81
Copy link
Contributor

@tomneedham assigning to you as you're familiar with that API. I'm aware that you might not have time, but let's see if you have some insights.

@PVince81
Copy link
Contributor

PVince81 commented Apr 6, 2017

moving to backlog as no one complained about this, maybe no one is actually using this pagination currently

@PVince81 PVince81 modified the milestones: backlog, 10.0 Apr 6, 2017
@ownclouders
Copy link
Contributor

Hey, this issue has been closed because the label status/STALE is set and there were no updates for 7 days. Feel free to reopen this issue if you deem it appropriate.

(This is an automated comment from GitMate.io.)

@ownclouders
Copy link
Contributor

Hey, this issue has been closed because the label status/STALE is set and there were no updates for 7 days. Feel free to reopen this issue if you deem it appropriate.

(This is an automated comment from GitMate.io.)

@stale
Copy link

stale bot commented Sep 20, 2021

This issue has been automatically closed.

@stale stale bot closed this as completed Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment