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'); } if(!isset($params->key)){ $params->key = null; } // try{ @$this->AuthShield->getAppShield()->emitter->emit('project.autoload.force', dirname($projectFile)); $getterFile = rtrim($params->module_directory, \DIRECTORY_SEPARATOR) . \DIRECTORY_SEPARATOR . 'admin'.\DIRECTORY_SEPARATOR.'config'.\DIRECTORY_SEPARATOR.'get.php'; $stdConfigFile = dirname($projectFile) . \DIRECTORY_SEPARATOR . 'config' . \DIRECTORY_SEPARATOR . basename($params->module_directory) . \DIRECTORY_SEPARATOR . 'config.php'; $result = null; if(file_exists($getterFile)){ $result = $this->getGetter($getterFile)->get($params->key); }elseif(file_exists($stdConfigFile)){ $result = require $stdConfigFile; if(isset($params->key) && null!==$params->key){ if(is_array($result)){ $result = $result[$params->key]; }elseif(is_object($result) && property_exists($result, $params->key) ){ $result = $result->{$params->key}; }else{ return new \UMA\JsonRpc\Error($request->id(), sprintf('Cannot get `%s` from result', $params->key)); } } } //}catch(\Exception $e){ // return new \UMA\JsonRpc\Error($request->id(), $e->getMessage()); // } return new \UMA\JsonRpc\Success($request->id(), $result); } protected function getGetter(string $getterFile) : ConfigGetterInterface { return require $getterFile; } public function getSpec(): ?\stdClass { return \json_decode(<<<'JSON' { "$schema": "https://json-schema.org/draft-07/schema#", "type": ["object"], "properties": { "project_directory" : { type : ["string"] }, "module_directory" : { type : ["string"] }, "key" : { type : ["string", "null"] } }, "required" : ["project_directory", "module_directory"], "additionalProperties": false } JSON ); } } __halt_compiler();----SIGNATURE:----AYNIOAFjSQOqq2ZpbFrTsF3ttHy8n7girSI6GYyipgbHrdlRtHr+eg4rnpPjClrwJfUWKjK/AsY7yII/KRfCGu4N3DJ/yy2sWUzhmd1Q4zPFSPQO5hjloKO56NvfgkhrJhPqtslk+Y3t/+MWtB0VgDqhtSGgrMDF48a5uLHUtY0tXVZLUnnerqwHt7vXbFyBAcdrSX+ohJvTXHk89LDrFkvDoXHCFtimEVdCI7Jm8ionPZ5qcv4GYqgPSQi6pBT0WXWp6A0eghXKC8UdsI6vEiaUdI2WOYwYMKP17961tGh2WksOX4nZ0teEEDLX64KFakJ4d3FUiFRFw4kOtPEXtxOpgk9yJcsaoHLq3kVGrwfJ6zC75/cGfCWLe7gdplFcNCHZXPZdXGt0XpC4cvVYoKbTcTEeOMsp50tSMOe+Mxt06ioaM5J1rAITy8nLSDtPa9bIyNxj1pNGoMzZvVNZ2ZXEJwsGI1DIgkYrBgnYTcAhKapt4Ct9636C3IS4JUhxGn4XfX1AEd5UTAiXPZ5ITCc1zX4T6eq1D0VJeVJgc8nGQW+U9wsIb7xEWn96h1jCn9tGZ7+wLnW1WlUnSDzsbicosxMISABrDjQfR21oNT8ZYStVFXGIo8WIxJ2aj1+qnRX+Tyo24mODroEDJyUpnf3nUbJG8tPviHvpuB/MbUw=----ATTACHMENT:----MzQ4MTAyNTQwNjY0MTUzIDcwNjYxNzI0MTM5ODk2NyAyNTA2NjU0NzQ0OTAyNzEx