Пример #1
0
 public static function getMetadata($params)
 {
     $cloud = $params['cloud'];
     if (isset($_SESSION['access_token_' . $cloud . '_v2'])) {
         $user = ProcManager::getInstance()->getCurrentProcess()->getLoginContext()->getEyeosUser()->getId();
         $path = $params['path'];
         $id = $params['id'];
         $resource_url = null;
         $token = new stdClass();
         if (isset($params['resource_url'])) {
             $token->key = $params['access_token_key'];
             $token->secret = $params['access_token_secret'];
             $resource_url = $params['resource_url'];
         } else {
             $token = $_SESSION['access_token_' . $cloud . '_v2'];
         }
         $apiManager = new ApiManager();
         $result = $apiManager->getMetadata($cloud, $token, $id, $path, $user, $resource_url);
         if ($result) {
             if (isset($result['error']) && $result['error'] == 403) {
                 $denied = self::permissionDeniedCloud($cloud);
                 $result['path'] = $denied['path'];
             }
         }
     } else {
         $result['error'] = -1;
         $result['description'] = "Access token not exists";
     }
     return $result;
 }