Closed PavelWeirich closed 3 years ago
What about to add method User::refresh()
to clear cache?
Yes it can be. But User::refresh() should run automatically when setNamespace() is called.
Or refactor private $identity = false; to private $identity = [];
The same refactor for: private $authenticated = [];
Sample of method getIdentity():
final public function getIdentity(): ?IIdentity
{
if (!array_key_exists($this->storage->getNamespace(), $this->identity)) {
$this->identity[$this->storage->getNamespace()] = $this->storage->getIdentity();
}
return $this->identity[$this->storage->getNamespace()];
}
In version 3.03 (https://github.com/nette/security/releases/tag/v3.0.3) the identity and authenticated state are cached. But it makes problem if you want to switch between namespaces.
For example in FrontModule\BasePresenter.php: public function startup() { parent::startup();
}
It always return ID from "admin" namespace.