mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 08:14:03 +02:00
parent
cc66175e6c
commit
dfc9c10589
@ -231,19 +231,7 @@ class NavigationConfigForm extends ConfigForm
|
|||||||
if ($this->hasBeenShared($name)) {
|
if ($this->hasBeenShared($name)) {
|
||||||
if ((! isset($data['users']) || !$data['users']) && (! isset($data['groups']) || !$data['groups'])) {
|
if ((! isset($data['users']) || !$data['users']) && (! isset($data['groups']) || !$data['groups'])) {
|
||||||
// It is shared but shouldn't anymore
|
// It is shared but shouldn't anymore
|
||||||
$config->removeSection($name);
|
$config = $this->unshare($name)->config; // unshare() calls setIniConfig()
|
||||||
$this->secondaryConfig = $config;
|
|
||||||
|
|
||||||
if (! $itemConfig->owner || $itemConfig->owner === $this->getUser()->getUsername()) {
|
|
||||||
$config = $this->getUserConfig();
|
|
||||||
} else {
|
|
||||||
$owner = new User($itemConfig->owner);
|
|
||||||
$config = $owner->loadNavigationConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
unset($itemConfig->owner);
|
|
||||||
unset($itemConfig->users);
|
|
||||||
unset($itemConfig->groups);
|
|
||||||
}
|
}
|
||||||
} elseif ((isset($data['users']) && $data['users']) || (isset($data['groups']) && $data['groups'])) {
|
} elseif ((isset($data['users']) && $data['users']) || (isset($data['groups']) && $data['groups'])) {
|
||||||
if ($this->getUser()->can('application/share/navigation')) {
|
if ($this->getUser()->can('application/share/navigation')) {
|
||||||
@ -303,15 +291,37 @@ class NavigationConfigForm extends ConfigForm
|
|||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return $this
|
||||||
*
|
*
|
||||||
* @throws NotFoundError In case no navigation item with the given name is found
|
* @throws NotFoundError In case no navigation item with the given name is found
|
||||||
*/
|
*/
|
||||||
public function unshare($name)
|
public function unshare($name)
|
||||||
{
|
{
|
||||||
|
$config = $this->getShareConfig();
|
||||||
|
if (! $config->hasSection($name)) {
|
||||||
throw new NotFoundError('No navigation item called "%s" found', $name);
|
throw new NotFoundError('No navigation item called "%s" found', $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$itemConfig = $config->getSection($name);
|
||||||
|
$config->removeSection($name);
|
||||||
|
$this->secondaryConfig = $config;
|
||||||
|
|
||||||
|
if (! $itemConfig->owner || $itemConfig->owner === $this->getUser()->getUsername()) {
|
||||||
|
$config = $this->getUserConfig();
|
||||||
|
} else {
|
||||||
|
$owner = new User($itemConfig->owner);
|
||||||
|
$config = $owner->loadNavigationConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($itemConfig->owner);
|
||||||
|
unset($itemConfig->users);
|
||||||
|
unset($itemConfig->groups);
|
||||||
|
|
||||||
|
$config->setSection($name, $itemConfig);
|
||||||
|
$this->setIniConfig($config);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user