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:----im02ExqeWp4SRir+PZdC0Y4FkI9eZ8EYjjf8hqZELbG1gp+tkAMTss+yM7S9BxDEmcwdAsB/34FV9lCK0EunzUm2oGJT1l0uZv0I7bgwKNIr7/DM98yzr+hpmOCFjQwDKEy0RjKh/Mc7lclyMo9vVLuevG9USh29TnKyzN36wiHGK/56cD+fzkEzYghJxWbzOdxL5+ZlxrBu4K2w0hQTFW4XYLAdWjaYNAr7iDvhcbhJB+1RQPznNwoYl/ijERInYCmLK9x9bAh7Y/jtyHoQZ0j8DEuYF0gVWdaCBEuBejRc8CDCKSTwDOTis4EYKzq7lzPepUWqiX2BzhFAj1Zv0qi07wcSd4ctHmnCDlgujlQ92cZp8s5IY/orKfHWhBIYlJS+3O1lZpNHn8SMcPxhM62OMGRyTLsHryVejHtgJ9riZGuXcoJM0om9vfNSz1iT7eEsjiNoW8y4Q3NFUnEGJeJVfvUCj7Lhof06GHeNled7fN8qpOnnOAjx083C/UYrT7moS9Fju3oNugVOweJsGG+eF2e9RpI+jcAaeUYs7XwXgf92dH5RgeCbvetlQ8uTRtjrITZm2xKOSmyBDl9CULWTaBCotw7alj4W5Qyl2rgtHoG9mEI9RNRdJuhtH+ImL+pTf/4yPvWNHr39eu76NX0X5fv7CAruUYPawsDv8h8=----ATTACHMENT:----Njg3MjY3NTk0Nzg5Mjg2MiA1MzEzNzQyMTU0NTg2MTcyIDEwMzE5MDIzNjY1MDY1Njc=