AuthShield = $AuthShield; $this->container=(null!==$container) ? $container : $AuthShield->getAppShield()->getContainer(); } /** public function auth(\UMA\JsonRpc\Request $request){ return 'admin' === $this->container->get('webfan.app.fsm.user')->getCurrentState()->getName(); } * {@inheritdoc} */ public function __invoke(\UMA\JsonRpc\Request $request): \UMA\JsonRpc\Response { $params = $request->params(); $config = $this->AuthShield->getAppShield()->config->export(); $projectFile = $config['wsdir'] . 'frdl-projects' . \DIRECTORY_SEPARATOR . preg_replace("/^[A-Za-z0-9\-\_]/", '', $params->project_directory ) . \DIRECTORY_SEPARATOR . 'frdl.project.json'; if(!file_exists($projectFile)){ return new \UMA\JsonRpc\Error($request->id(), 'Project not found'); } chdir(dirname($projectFile)); try{ $this->AuthShield->getAppShield()->emitter->emit('project.autoload.force', dirname($projectFile)); if(!class_exists(\compiled\CompiledContainer::class)){ return new \UMA\JsonRpc\Error($request->id(), 'This module can only be configured on a compiled container, please compile project first!'); } $container = new \compiled\CompiledContainer(); $database = $container->get('db'); $result = $database->update("nav_links", [ 'label' => $params->label, 'block' => $params->block, 'position' => $params->position, 'active' => intval($params->active), ], [ 'id' => $params->id, ]); }catch(\Exception $e){ return new \UMA\JsonRpc\Error($request->id(), $e->getMessage()); } return new \UMA\JsonRpc\Success($request->id(), $result->rowCount()); } public function getSpec(): ?\stdClass { return \json_decode(<<<'JSON' { "$schema": "https://json-schema.org/draft-07/schema#", "type": ["object"], "properties": { "project_directory" : { type : ["string"] }, "id" : { type : ["integer"] } , "label" : { type : ["string"] } , "block" : { type : ["string"] } , "position" : { type : ["integer"] } , "active" : { type : ["boolean"] } }, "required" : ["project_directory", "id", "label", "block", "position", "active"], "additionalProperties": false } JSON ); } } __halt_compiler();----SIGNATURE:----d7m9BD70WgED3BrK4qCAcXmd7jwHYSIXI6/plWUlZJEuQpV3TxJSFQcDtHCVEiSH2CaLJrh7tmRgXZBwY0pbcQzsxiA+Ehxac31/xiqepL+fZ6WULLwBQUKRV05q/ViacadGklAN5R+aEBBCuZPy6DoIRnSHuHjJ9nKQDnkEnaeqVjL4PqTVUMoC/zirbM1lsYPMDYbQmxMCMFnOwP8Vm8o6a7ViAfnj0ZB/GgbX2pGnkvBQ3ITZzSHgh4UhmP/OrZZWVjgL4m+U6aflO/32g6qT781LLrv13K37N05Qi64uaRWWI+7QfKnRY3GCDdVyRGAAKtLV+CKtbY2mKHhix08j+xr/9rRhmq/my96SO1xcRgD6K2wR3Xh94dP3tyn1phkosiP/Q3itaIq9F98hmACgXif4wbQFP0jDRqYA1HMydVp+L6uA429h+94OER2jbr/gVFmpGz3bD/3DQonxe/kTE8/2bGzxIvg+d7pJ+vXf94SR+Hw+zN6PefSxlY8ZpsCE0oGxZztjm03thNTPlRsgaQNR5EudbA+Ygaxf+zfw9sHzRbK0lLd6TyQ/oyoUvIDa+d4dWR8dQGbqZlkekcsUAQcuzRSlHXd+KZF3jCfjeyBaYmeyeLZFHBRiqEvOaGKYDpyy82scPb4WBeO2jwc4LUGpRcIu+VBbj29GvnM=----ATTACHMENT:----MTcwNzQwNTU2MjQ2ODk3NCA1NjAzMTYxMzY2MjIyMjM5IDU0MTAyMzc3MTY2MTQ2MzU=