Skip to content

Commit bda20b7

Browse files
author
Noé
committed
FIX: Too heavy sql query
1 parent dcc4334 commit bda20b7

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

htdocs/user/class/user.class.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3958,10 +3958,9 @@ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset =
39583958
if (!empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
39593959
$sql .= " WHERE t.entity IS NOT NULL"; // Show all users
39603960
} else {
3961-
$sql .= ",".$this->db->prefix()."usergroup_user as ug";
3962-
$sql .= " WHERE ((ug.fk_user = t.rowid";
3963-
$sql .= " AND ug.entity IN (".getEntity('usergroup')."))";
3964-
$sql .= " OR t.entity = 0)"; // Show always superadmin
3961+
$sql .= " WHERE t.entity = 0 OR EXISTS (";
3962+
$sql .= " SELECT ug.rowid FROM " . $this->db->prefix() . "usergroup_user as ug";
3963+
$sql .= " WHERE ug.fk_user = t.rowid AND ug.entity IN (" . getEntity('usergroup') . "))";
39653964
}
39663965
} else {
39673966
$sql .= " WHERE t.entity IN (".getEntity('user').")";

0 commit comments

Comments
 (0)