Skip to content

Commit c6d8e5c

Browse files
Auth::applyRestrictions(): Don't take redundancy_group into account
Otherwise, redundany_group objects are not visible. - New filter : Either the host/service is null (the object is a redundancy group) or given restrictions match
1 parent 6262885 commit c6d8e5c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Diff for: library/Icingadb/Common/Auth.php

+9-3
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,14 @@ public function applyRestrictions(Query $query)
168168
}
169169

170170
if ($customVarRelationName === false || count($relations) > 1) {
171-
if (($restriction = $role->getRestrictions('icingadb/filter/objects'))) {
172-
$roleFilter->add($this->parseRestriction($restriction, 'icingadb/filter/objects'));
171+
if ($restriction = $role->getRestrictions('icingadb/filter/objects')) {
172+
$roleFilter->add(Filter::any(
173+
Filter::all(
174+
Filter::unlike('host.id', '*'),
175+
Filter::unlike('service.id', '*')
176+
),
177+
$this->parseRestriction($restriction, 'icingadb/filter/objects')
178+
));
173179
}
174180

175181
if ($applyHostRestriction && ($restriction = $role->getRestrictions('icingadb/filter/hosts'))) {
@@ -178,7 +184,7 @@ public function applyRestrictions(Query $query)
178184
$this->forceQueryOptimization($hostFilter, 'hostgroup.name');
179185
}
180186

181-
$roleFilter->add($hostFilter);
187+
$roleFilter->add(Filter::any(Filter::unlike('host.id', '*'), $hostFilter));
182188
}
183189

184190
if (

0 commit comments

Comments
 (0)