Skip to content

Commit 72d934c

Browse files
Internal: Correct user group filtering and unassignment in URL edit - refs BT#22643
1 parent aa67a32 commit 72d934c

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

public/main/admin/access_url_edit_usergroup_to_url.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
}
5454
}
5555

56-
$noUserGroupList = $userGroup->getUserGroupNotInList(array_keys($userGroupList));
56+
$noUserGroupList = $userGroup->getUserGroupNotInList(array_keys($userGroupList), $access_url_id);
5757
$url_list = UrlManager::get_url_data();
5858

5959
$totalGroups = count($userGroupList) + count($noUserGroupList);

public/main/inc/lib/usergroup.lib.php

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,23 +1514,18 @@ public function filterByFirstLetter($firstLetter, $limit = 0)
15141514

15151515
/**
15161516
* Select user group not in list.
1517-
*
1518-
* @param array $list
1519-
*
1520-
* @return array
15211517
*/
1522-
public function getUserGroupNotInList(array $list): array
1518+
public function getUserGroupNotInList(array $list, int $accessUrlId): array
15231519
{
1524-
$urlId = api_get_current_access_url_id();
15251520
$params = [];
15261521

15271522
$sql = "SELECT g.*
1528-
FROM $this->table g";
1523+
FROM {$this->table} g";
15291524

15301525
if ($this->getUseMultipleUrl()) {
1531-
$sql .= " LEFT JOIN $this->access_url_rel_usergroup a
1532-
ON (g.id = a.usergroup_id AND a.access_url_id = ?)";
1533-
$params[] = $urlId;
1526+
$sql .= " LEFT JOIN {$this->access_url_rel_usergroup} a
1527+
ON (g.id = a.usergroup_id AND a.access_url_id = ?)";
1528+
$params[] = $accessUrlId;
15341529
$sql .= " WHERE a.usergroup_id IS NULL";
15351530
} else {
15361531
$sql .= " WHERE 1=1";
@@ -1544,9 +1539,9 @@ public function getUserGroupNotInList(array $list): array
15441539

15451540
$sql .= " ORDER BY g.title";
15461541

1547-
$result = Database::getManager()->getConnection()->executeQuery($sql, $params);
1542+
$stmt = Database::getManager()->getConnection()->executeQuery($sql, $params);
15481543

1549-
return Database::store_result($result, 'ASSOC');
1544+
return Database::store_result($stmt, 'ASSOC');
15501545
}
15511546

15521547
/**

0 commit comments

Comments
 (0)