mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-23 22:04:25 +02:00
NavigationConfigForm: Show only an owner's parents to admins
refs #5600
This commit is contained in:
parent
3f70351239
commit
8239ec8fb5
@ -181,9 +181,12 @@ class NavigationConfigForm extends ConfigForm
|
|||||||
/**
|
/**
|
||||||
* Return a list of available parent items for the given type of navigation item
|
* Return a list of available parent items for the given type of navigation item
|
||||||
*
|
*
|
||||||
|
* @param string $type
|
||||||
|
* @param string $owner
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function listAvailableParents($type)
|
public function listAvailableParents($type, $owner = null)
|
||||||
{
|
{
|
||||||
$children = $this->itemToLoad ? $this->getFlattenedChildren($this->itemToLoad) : array();
|
$children = $this->itemToLoad ? $this->getFlattenedChildren($this->itemToLoad) : array();
|
||||||
|
|
||||||
@ -192,7 +195,7 @@ class NavigationConfigForm extends ConfigForm
|
|||||||
if (
|
if (
|
||||||
$sectionName !== $this->itemToLoad
|
$sectionName !== $this->itemToLoad
|
||||||
&& $sectionConfig->type === $type
|
&& $sectionConfig->type === $type
|
||||||
&& $sectionConfig->owner === $this->getUser()->getUsername()
|
&& $sectionConfig->owner === ($owner ?: $this->getUser()->getUsername())
|
||||||
&& !in_array($sectionName, $children, true)
|
&& !in_array($sectionName, $children, true)
|
||||||
) {
|
) {
|
||||||
$names[] = $sectionName;
|
$names[] = $sectionName;
|
||||||
@ -564,7 +567,13 @@ class NavigationConfigForm extends ConfigForm
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (! $shared && $itemForm->requiresParentSelection()) {
|
if (! $shared && $itemForm->requiresParentSelection()) {
|
||||||
$availableParents = $this->listAvailableParents($itemType);
|
if ($this->itemToLoad && $this->hasBeenShared($this->itemToLoad)) {
|
||||||
|
$itemConfig = $this->getShareConfig()->getSection($this->itemToLoad);
|
||||||
|
$availableParents = $this->listAvailableParents($itemType, $itemConfig->owner);
|
||||||
|
} else {
|
||||||
|
$availableParents = $this->listAvailableParents($itemType);
|
||||||
|
}
|
||||||
|
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'select',
|
'select',
|
||||||
'parent',
|
'parent',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user