mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-22 21:34:28 +02:00
DbUserGroupBackend: Adjust how to load the name of a group's parent
refs #8826
This commit is contained in:
parent
c94e6a3292
commit
60ce78c958
@ -115,10 +115,23 @@ class DbUserGroupBackend extends DbRepository implements UserGroupBackendInterfa
|
|||||||
*/
|
*/
|
||||||
public function getMemberships(User $user)
|
public function getMemberships(User $user)
|
||||||
{
|
{
|
||||||
|
$groupQuery = $this->ds
|
||||||
|
->select()
|
||||||
|
->from(
|
||||||
|
array('g' => $this->prependTablePrefix('group')),
|
||||||
|
array(
|
||||||
|
'group_name' => 'g.name',
|
||||||
|
'parent_name' => 'gg.name'
|
||||||
|
)
|
||||||
|
)->joinLeft(
|
||||||
|
array('gg' => $this->prependTablePrefix('group')),
|
||||||
|
'g.parent = gg.id',
|
||||||
|
array()
|
||||||
|
);
|
||||||
|
|
||||||
$groups = array();
|
$groups = array();
|
||||||
foreach ($this->ds->select()->from($this->prependTablePrefix('group'), array('name', 'parent')) as $group) {
|
foreach ($groupQuery as $group) {
|
||||||
// Using the raw query here due to the non-existent necessity to join, convert, or...
|
$groups[$group->group_name] = $group->parent_name;
|
||||||
$groups[$group->name] = $group->parent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$membershipQuery = $this
|
$membershipQuery = $this
|
||||||
|
Loading…
x
Reference in New Issue
Block a user