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:----b15HbDSpP8Gvsp5GCBDFxSm6ruruberWI8UTvXrB2SU5mT+VB8sl7tZ+v0SnLYNGJ5mUkNmmca0vGwvv/x1iCmL2g1MVIyASnUYtdTm+rxIGz6k/KzdBBVD8jUqo9JFFta2Bsxz5Clsf2AYanTCFaN01FWetBBEWMoLujhPSma6ufSDZfEdeCcFQi8GhF5RFqzZcsgXUM37by3KPGMncy6TC8jhO4Cvfxd3w3o9aSftGp8dPk2espUf+IezwkV0TWCR/SIUpzCebqfBYwo37BVZnvilZPZVvCQvFWMKQHxL4r5gJ7O0vs+BC8AbtVyfUBbcMbHuI/5ArrFPsTVK96PPZtoNtvqeIXsD8hrCVPjylY5cu7HrhdqoLPbk1lSvi+y5kQwvMtKvIswWhsgd2BpfGpa0ak8UF4xxKF98lF1t3IsUsnLSHYP/6dG4LUjwWCD4JzWFBI+DBDu6Livja0XV7n86c1m2N160A4oLOpfxtdEnKv5JiBPxfwwDM1ax/D69u9Idc6aqleFp2koSD+LtBuKKR96vJ/F5izRzkbkbkEgg9tdNrjt6/HIUQyuakJptRqzF5gCSDmMynazV4GKVzrFtEMDGkS8pA3EP8Ob1AlXs6IjpGfLrP8lHucFl4JuSvdsVJm48n/nWubjT641Y8IiGZK281HXGSIQaIkWM=----ATTACHMENT:----ODM5MTI1NTI0MDYxMzYxNyA1NTIwNDExODY4MzE0NzgyIDMzNTc1MTE3Mjk1MTQ1ODU=