user->isAdmin(); } public function postActionUpload(Request $request): StdClass { $body = $request->getBodyContents(); $manager = new ExtensionManager($this->getContainer()); $id = $manager->upload($body); $manifest = $manager->getManifest(); return (object) [ 'id' => $id, 'version' => $manifest['version'], 'name' => $manifest['name'], 'description' => $manifest['description'], ]; } public function postActionInstall(Request $request): bool { $data = $request->getParsedBody(); if ($this->config->get('restrictedMode')) { if (!$this->user->isSuperAdmin()) { throw new Forbidden(); } } $manager = new ExtensionManager($this->getContainer()); $manager->install(get_object_vars($data)); return true; } public function postActionUninstall(Request $request): bool { $data = $request->getParsedBody(); if ($this->config->get('restrictedMode')) { if (!$this->user->isSuperAdmin()) { throw new Forbidden(); } } $manager = new ExtensionManager($this->getContainer()); $manager->uninstall(get_object_vars($data)); return true; } public function deleteActionDelete(Request $request, Response $response): bool { $params = $request->getRouteParams(); if ($this->config->get('restrictedMode')) { if (!$this->user->isSuperAdmin()) { throw new Forbidden(); } } $manager = new ExtensionManager($this->getContainer()); $manager->delete($params); return true; } public function beforeCreate(): void { throw new Forbidden(); } public function beforeUpdate(): void { throw new Forbidden(); } }