/**
  * Test accessibility for the given partner, secret and server
  * @dataProvider accessibilitySuccessProvider
  */
 public function testAccessibilitySuccess($partnerId, $secret, $configServiceUrl, $isAdmin, $userId)
 {
     $testedClient = $this->getClient($partnerId, $secret, $configServiceUrl, $isAdmin, $userId);
     $permissions = $this->getPermissionsItems($testedClient, $userId, $partnerId, $isAdmin, $configServiceUrl);
     $alwaysAllowedActions = $this->getAlwaysAllowedActions($partnerId);
     $serviceMap = KalturaServicesMap::getMap();
     $services = array_keys($serviceMap);
     //		$this->testSingleService("batchcontrol", $testedClient, $permissions, $alwaysAllowedActions);
     foreach ($services as $service) {
         //We skip the session service
         if ($service == "session") {
             continue;
         }
         $serviceReflector = new KalturaServiceReflector($service);
         $actions = array_keys($serviceReflector->getActions());
         $serviceName = $serviceReflector->getServiceName();
         foreach ($actions as $action) {
             $params = $this->getActionParams($action, $serviceReflector);
             if ($action == "list") {
                 $action .= "Action";
             }
             try {
                 if (method_exists($testedClient->{$serviceName}, $action)) {
                     call_user_func_array(array($testedClient->{$serviceName}, $action), $params);
                     //TODO: Handle non exception cases
                     $this->compareServiceAction($permissions, $alwaysAllowedActions, $serviceName, $action);
                 } else {
                     //TODO: handle method doesn't exists...
                 }
             } catch (Exception $ex) {
                 //Check if the service / action is found in the user permissions
                 $this->compareServiceAction($permissions, $alwaysAllowedActions, $serviceName, $action, $ex);
             }
         }
     }
 }
<?php

require_once "../../bootstrap.php";
KalturaLog::setContext("TESTME");
$service = $_GET["service"];
$action = $_GET["action"];
$bench_start = microtime(true);
KalturaLog::INFO(">------- api_v3 testme [{$service}][{$action}]-------");
function toArrayRecursive(KalturaPropertyInfo $propInfo)
{
    return $propInfo->toArray();
}
$serviceMap = KalturaServicesMap::getMap();
$actionInfo = null;
try {
    $serviceReflector = $serviceMap[strtolower($service)];
    /* @var $serviceReflector KalturaServiceActionItem */
    $actionReflector = new KalturaActionReflector($service, $action, $serviceReflector->actionMap[$action]);
    $actionParams = $actionReflector->getActionParams();
    $actionInfo = $actionReflector->getActionInfo();
    $actionInfo = array("actionParams" => array(), "description" => $actionInfo->description);
    foreach ($actionParams as $actionParam) {
        $actionInfo["actionParams"][] = toArrayRecursive($actionParam);
    }
} catch (Exception $ex) {
    KalturaLog::ERR("<------- api_v3 testme [{$service}][{$action}\n" . $ex->__toString() . " " . " -------");
}
//echo "<pre>";
//echo print_r($actionInfo);
echo json_encode($actionInfo);
$bench_end = microtime(true);
 public function setIncludeOrExcludeList($include, $exclude, $excludePaths = null)
 {
     $this->initClassMap();
     $this->_excludePathList = array();
     if ($excludePaths !== null) {
         $tempList = explode(",", str_replace(" ", "", $excludePaths));
         foreach ($tempList as $item) {
             $this->_excludePathList[] = realpath(dirname(__FILE__) . "/../../{$item}");
         }
     }
     // load full list of actions and services
     $fullList = array();
     $serviceMap = null;
     $serviceMap = KalturaServicesMap::getMap();
     foreach ($serviceMap as $serviceId => $serviceActionItem) {
         /* @var $serviceActionItem KalturaServiceActionItem */
         foreach ($serviceActionItem->actionMap as $actionId => $actionCallback) {
             list($serviceClass, $actionMethodName) = array_values($actionCallback);
             $servicePath = $this->_classMap[$serviceClass];
             if ($this->isPathExcluded($servicePath)) {
                 continue;
             }
             $fullList[strtolower($serviceId)][strtolower($actionId)] = true;
         }
     }
     $includeList = array();
     if ($include !== null) {
         $tempList = explode(",", str_replace(" ", "", $include));
         foreach ($tempList as $item) {
             $service = null;
             $action = null;
             $item = strtolower($item);
             if (strpos($item, ".") !== false) {
                 list($service, $action) = explode(".", $item);
             }
             if (!key_exists($service, $includeList)) {
                 $includeList[$service] = array();
             }
             if ($action == "*") {
                 if (!array_key_exists($service, $fullList)) {
                     throw new Exception("Service [{$service}] not found");
                 }
                 $includeList[$service] = $fullList[$service];
             } else {
                 $includeList[$service][$action] = true;
             }
         }
     } else {
         if ($exclude !== null) {
             $includeList = $fullList;
             $tempList = explode(",", str_replace(" ", "", $exclude));
             foreach ($tempList as $item) {
                 $service = null;
                 $action = null;
                 $item = strtolower($item);
                 if (strpos($item, ".") !== false) {
                     list($service, $action) = explode(".", $item);
                 }
                 if ($action == "*") {
                     //				KalturaLog::debug("Excluding service [$service]");
                     unset($includeList[$service]);
                 } else {
                     //				KalturaLog::debug("Excluding action [$service.$action]");
                     unset($includeList[$service][$action]);
                 }
             }
         } else {
             $includeList = $fullList;
         }
     }
     $this->setIncludeList($includeList);
 }
 public function isServiceExists($serviceId)
 {
     if (array_key_exists($serviceId, $this->_servicesMap)) {
         return true;
     }
     if (strpos($serviceId, '_') <= 0) {
         return false;
     }
     $serviceId = strtolower($serviceId);
     list($servicePlugin, $serviceName) = explode('_', $serviceId);
     $pluginInstances = KalturaPluginManager::getPluginInstances('IKalturaServices');
     if (!isset($pluginInstances[$servicePlugin])) {
         return false;
     }
     $pluginInstance = $pluginInstances[$servicePlugin];
     $servicesMap = $pluginInstance->getServicesMap();
     KalturaLog::debug(print_r($servicesMap, true));
     foreach ($servicesMap as $name => $class) {
         if (strtolower($name) == $serviceName) {
             $class = $servicesMap[$name];
             KalturaServicesMap::addService($serviceId, $class);
             $this->_servicesMap = KalturaServicesMap::getMap();
             return true;
         }
     }
     return false;
 }
 public function setIncludeOrExcludeList($include, $exclude)
 {
     // load full list of actions and services
     $fullList = array();
     $serviceMap = KalturaServicesMap::getMap();
     $services = array_keys($serviceMap);
     foreach ($services as $service) {
         $serviceReflector = new KalturaServiceReflector($service);
         $actions = $serviceReflector->getActions();
         foreach ($actions as &$action) {
             // we need only the keys
             $action = true;
         }
         $fullList[$service] = $actions;
     }
     $includeList = array();
     if ($include !== null) {
         $tempList = explode(",", str_replace(" ", "", $include));
         foreach ($tempList as $item) {
             $service = null;
             $action = null;
             $item = strtolower($item);
             if (strpos($item, ".") !== false) {
                 list($service, $action) = explode(".", $item);
             }
             if (!key_exists($service, $includeList)) {
                 $includeList[$service] = array();
             }
             if ($action == "*") {
                 if (!array_key_exists($service, $fullList)) {
                     throw new Exception("Service [{$service}] not found");
                 }
                 $includeList[$service] = $fullList[$service];
             } else {
                 $includeList[$service][$action] = true;
             }
         }
     } else {
         if ($exclude !== null) {
             $includeList = $fullList;
             $tempList = explode(",", str_replace(" ", "", $exclude));
             foreach ($tempList as $item) {
                 $service = null;
                 $action = null;
                 $item = strtolower($item);
                 if (strpos($item, ".") !== false) {
                     list($service, $action) = explode(".", $item);
                 }
                 if ($action == "*") {
                     //				KalturaLog::debug("Excluding service [$service]");
                     unset($includeList[$service]);
                 } else {
                     //				KalturaLog::debug("Excluding action [$service.$action]");
                     unset($includeList[$service][$action]);
                 }
             }
         } else {
             $includeList = $fullList;
         }
     }
     $this->setIncludeList($includeList);
 }