Properly handle window id's and container id's

This commit is contained in:
Johannes Meyer 2020-01-14 09:46:26 +01:00
parent 2d3fc218db
commit 855bb8ae72
3 changed files with 4 additions and 10 deletions

View File

@ -229,10 +229,9 @@ class ActionController extends Zend_Controller_Action
public function Window()
{
if ($this->window === null) {
$this->window = new Window(
$this->_request->getHeader('X-Icinga-WindowId', Window::UNDEFINED)
);
$this->window = Window::getInstance();
}
return $this->window;
}

View File

@ -114,12 +114,7 @@ class Request extends Zend_Controller_Request_Http
*/
public function protectId($id)
{
if (! isset($this->uniqueId)) {
$windowId = $this->getHeader('X-Icinga-WindowId');
$this->uniqueId = empty($windowId) ? Window::generateId() : $windowId;
}
return $id . '-' . $this->uniqueId;
return $id . '-' . Window::getInstance()->getContainerId();
}
public function getPost($key = null, $default = null)

View File

@ -113,8 +113,8 @@ class Window
if (! isset(static::$window)) {
$id = Icinga::app()->getRequest()->getHeader('X-Icinga-WindowId');
if (empty($id) || $id === static::UNDEFINED) {
Icinga::app()->getResponse()->setOverrideWindowId();
$id = static::generateId();
Icinga::app()->getResponse()->setHeader('X-Icinga-WindowId', $id);
}
static::$window = new Window($id);