/**
  * Method to list shellcommands by webservice
  *
  * @param array $params       Options
  * @param string $protocol    Communication protocol used
  *
  * @return array or error value
  */
 static function methodList($params, $protocol)
 {
     if (isset($params['help'])) {
         return array('help' => 'bool,optional');
     }
     if (!Session::getLoginUserID()) {
         return PluginWebservicesMethodCommon::Error($protocol, WEBSERVICES_ERROR_NOTAUTHENTICATED);
     }
     $shellcommandsList = array();
     $command = new PluginShellcommandsShellcommand();
     $commandItems = new PluginShellcommandsShellcommand_Item();
     foreach ($command->find('is_deleted = 0', 'name ASC') as $currentCommand) {
         $currentCommandTargets = array();
         foreach ($commandItems->find('`plugin_shellcommands_shellcommands_id` = ' . $currentCommand['id'] . '') as $currentItem) {
             $currentCommandTargets[] = $currentItem['itemtype'];
         }
         $shellcommandsList[] = array('id' => $currentCommand['id'], 'name' => $currentCommand['name'], 'targets' => $currentCommandTargets);
     }
     return $shellcommandsList;
 }