-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
[provisioning_api] Optimization for for large installations #17718
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -254,13 +254,22 @@ public function isUserAccessible(IUser $subadmin, IUser $user): bool { | |||
| if($this->groupManager->isAdmin($user->getUID())) { | ||||
| return false; | ||||
| } | ||||
| $accessibleGroups = $this->getSubAdminsGroups($subadmin); | ||||
| foreach($accessibleGroups as $accessibleGroup) { | ||||
| if($accessibleGroup->inGroup($user)) { | ||||
| return true; | ||||
| } | ||||
| } | ||||
| return false; | ||||
|
|
||||
| $qb = $this->dbConn->getQueryBuilder(); | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ah you are right. I did not think about that. If you point me in a direction I can look into it?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||||
|
|
||||
| $result = $qb->select('gm.uid') | ||||
| ->from('group_admin', 'ga') | ||||
| ->join('ga', 'group_admin', 'gm', 'ga.gid = gm.gid') | ||||
| ->andWhere($qb->expr()->eq('ga.uid', $qb->createNamedParameter($subadmin->getUID()))) | ||||
| ->andWhere($qb->expr()->eq('gm.uid', $qb->createNamedParameter($user->getUID()))) | ||||
| ->setMaxResults(1) | ||||
| ->execute(); | ||||
| ; | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
|
|
||||
| $isUserAccessible = $result->fetch(); | ||||
| $result->closeCursor(); | ||||
|
|
||||
| return $isUserAccessible !== 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.
This is a nice turn around 👍