container = $container; } public function isPortal() : bool { return $this->container->has('portal'); } public function getPortalId() : string { if (!$this->isPortal()) throw new Error("Can't get portal ID for non-portal application."); return $this->getPortal()->id; } public function getPortal() : PortalEntity { if (!$this->isPortal()) throw new Error("Can't get portal for non-portal application."); return $this->container->get('portal'); } public function getUser() : UserEntity { return $this->container->get('user'); } public function isLogged() : bool { if (!$this->continer->has('user')) return false; if ($this->getUser()->isSystem()) return false; return true; } public function isAdmin() : bool { if (!$this->isLogged()) return false; return $this->getUser()->isAdmin(); } public function isApi() : bool { if (!$this->isLogged()) return false; return $this->getUser()->isApi(); } }