-
-
Notifications
You must be signed in to change notification settings - Fork 4.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
[provisioning_api] Optimization for for large installations #17718
Conversation
… where subadmins have access to many of groups (>250) - Current implementation in isUserAccessible() iterates over each group a subadmin is member of - UsersController:editUser() calls isUserAccessible() even if the user is admin This fix reduces API calls to editUser (ex change locale/display name) from >2 minutes (!) to ~3 seconds per call in average. Signed-off-by: Mikael Hammarin <mikael@try2.se>
->andWhere($qb->expr()->eq('gm.uid', $qb->createNamedParameter($user->getUID()))) | ||
->setMaxResults(1) | ||
->execute(); | ||
; |
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.
; |
Thanks for your patch 🎉 |
} | ||
return false; | ||
|
||
$qb = $this->dbConn->getQueryBuilder(); |
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 only works with the default groups backend, so this is not possible. But I have another idea in mind to make this faster
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 only works with the default groups backend, so this is not possible. But I have another idea in mind to make this faster
Ah you are right. I did not think about that. If you point me in a direction I can look into it?
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.
Supposedly, fetch the user's groups and check whether there is an overlap.
@@ -499,8 +499,8 @@ public function editUser(string $userId, string $key, string $value): DataRespon | |||
} else { | |||
// Check if admin / subadmin | |||
$subAdminManager = $this->groupManager->getSubAdmin(); | |||
if ($subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser) | |||
|| $this->groupManager->isAdmin($currentLoggedInUser->getUID())) { | |||
if ($this->groupManager->isAdmin($currentLoggedInUser->getUID()) |
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 is a nice turn around 👍
What's the state here? |
Did a new PR in #20677 |
Patch to optimize for large installations where subadmins have access to many groups (>250)
This fix reduces API calls to editUser (ex change locale/display name) from >2 minutes (!) to ~3 seconds per call in average in current installation.
Signed-off-by: Mikael Hammarin mikael@try2.se