Changeset 7442


Ignore:
Timestamp:
10/18/12 18:05:27 (7 years ago)
Author:
eduardow
Message:

Ticket #3093 - Integrando API Rest (CELEPAR) - commit para o branches.

Location:
branches/2.4
Files:
20 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.4/prototype/config/Tonic.srv

    r7231 r7442  
     1[/AvailableServers]  
     2AvailableServersResource = /availableServers/AvailableServersResource.php  
     3  
     4[/Catalog/Contacts]  
     5ContactsResource = /catalog/ContactsResource.php  
     6  
     7[/Catalog/ContactPicture]  
     8ContactPictureResource = /catalog/ContactPictureResource.php  
     9  
     10[/Calendar/Events]  
     11EventsResource = /calendar/EventsResource.php  
     12  
     13[/dynamiccontacts]  
     14DynamicContactsResource = /catalog/DynamicContactsResource.php  
     15  
     16[/dynamiccontact/:id]  
     17DynamicContactResource = /catalog/DynamicContactResource.php  
     18  
     19[/ExpressoVersion]  
     20ExpressoVersionResource = /core/ExpressoVersionResource.php  
     21  
     22[/groups]  
     23GroupsResource = /catalog/GroupsResource.php  
     24  
     25[/group/:id]  
     26GroupResource = /catalog/GroupResource.php  
     27  
     28[/Login]  
     29LoginResource = /core/LoginResource.php  
     30  
     31[/Logout]  
     32LogoutResource = /core/LogoutResource.php  
     33  
     34[/Mail/AddFolder]  
     35AddFolderResource = /mail/AddFolderResource.php  
     36  
     37[/Mail/Attachment]  
     38AttachmentResource = /mail/AttachmentResource.php  
     39  
     40[/Mail/CleanTrash]  
     41CleanTrashResource = /mail/CleanTrashResource.php  
     42  
     43[/Mail/DelFolder]  
     44DelFolderResource = /mail/DelFolderResource.php  
     45  
     46[/Mail/DelMessage]  
     47DelMessageResource = /mail/DelMessageResource.php  
     48  
     49[/Mail/Folders]  
     50FoldersResource = /mail/FoldersResource.php  
     51  
     52[/Mail/RenameFolder]  
     53RenameFolderResource = /mail/RenameFolderResource.php  
     54  
     55[/Mail/Messages]  
     56MessagesResource = /mail/MessagesResource.php  
     57  
     58[/Mail/Send]  
     59SendResource = /mail/SendResource.php  
     60  
     61[/Mail/SendSupportFeedback]  
     62SendSupportFeedbackResource = /mail/SendSupportFeedbackResource.php  
     63  
     64[/personalContact]  
     65PersonalContactResource = /catalog/PersonalContactResource.php  
     66  
     67[/personalContact/:id]  
     68PersonalContactResource = /catalog/PersonalContactResource.php  
     69 
    170[/token] 
    271TokenResource = /oauth/TokenResource.php 
     72 
     73[/usercontacts]  
     74UserContactsResource = /catalog/UserContactsResource.php  
    375 
    476[/usersldap] 
     
    880UserResource = /user/UserResource.php 
    981 
    10 [/personalContact] 
    11 PersonalContactResource = /catalog/PersonalContactResource.php 
    12  
    13 [/personalContact/:id] 
    14 PersonalContactResource = /catalog/PersonalContactResource.php 
    15  
    1682[/sharedcontact/:id] 
    1783SharedContactResource = /catalog/SharedContactResource.php 
    1884 
    19 [/groups] 
    20 GroupsResource = /catalog/GroupsResource.php 
    21  
    22 [/group/:id] 
    23 GroupResource = /catalog/GroupResource.php 
    24  
    2585[/sharedgroup/:id] 
    2686SharedGroupResource = /catalog/SharedGroupResource.php 
    27  
    28 [/dynamiccontacts] 
    29 DynamicContactsResource = /catalog/DynamicContactsResource.php 
    30  
    31 [/dynamiccontact/:id] 
    32 DynamicContactResource = /catalog/DynamicContactResource.php 
    33  
    34 [/usercontacts] 
    35 UserContactsResource = /catalog/UserContactsResource.php 
  • branches/2.4/prototype/config/user.ini

    r6754 r7442  
    4444givenName = givenName 
    4545sn = sn 
    46 dn = dn 
    47 vacationInfo = vacationInfo 
    48 vacationActive = vacationActive 
    4946displayName = displayName 
    5047mailAlternateAddress = mailAlternateAddress 
     
    5552phpgwAccountVisible = phpgwAccountVisible 
    5653gidNumber = gidNumber 
    57 telephoneNumber=telephoneNumber 
     54 
     55[Applications.mapping]  
     56mail = expressoMail1_2  
     57catalog = contactcenter  
     58calendar = calendar  
  • branches/2.4/prototype/rest/dispatch.php

    r6754 r7442  
    11<?php 
    22// load Tonic library 
    3 require_once __DIR__ . '/../library/tonic/lib/tonic.php'; 
    4 require_once __DIR__ . '/../api/controller.php'; 
    5 require_once ROOTPATH . '/rest/oauth/OAuth2StorageUserCredential.php'; 
     3require_once(__DIR__ . '/../library/tonic/lib/tonic.php');  
     4require_once(__DIR__.'/../library/utils/Errors.php');  
     5require_once(__DIR__ . '/../api/controller.php');  
     6require_once(ROOTPATH . '/rest/oauth/OAuth2StorageUserCredential.php');  
     7     
     8// load adapters  
     9require_once(__DIR__."/../adapters/ExpressoAdapter.php");  
     10require_once(__DIR__."/../adapters/MailAdapter.php");  
     11require_once(__DIR__."/../adapters/CatalogAdapter.php");  
     12require_once(__DIR__."/../adapters/CalendarAdapter.php");  
    613 
    714//Retrieveing the mapping of the URIs and his respectives classNames and classPath 
     
    1825$classpath = array(); 
    1926 
    20 foreach( $config as $uri => $classFile ){ 
     27foreach( $config as $uri => $classFile )  
     28{ 
    2129    foreach( $classFile as $className => $filePath ) 
    2230    { 
    23         $autoload[ $uri ] = $className; 
    24         $classpath[ $className ] = $filePath; 
     31           $autoload[ $uri ] = $className; 
     32           $classpath[ $className ] = $filePath; 
    2533    } 
    2634} 
     
    4957 
    5058} catch (ResponseException $e) { 
    51     switch ($e->getCode()) { 
    52     case Response::UNAUTHORIZED: 
    53         $response = $e->response($request); 
    54         $response->addHeader('WWW-Authenticate', 'Basic realm="Tonic"'); 
    55         break; 
    56     default: 
    57         $response = $e->response($request); 
     59    switch ($e->getCode())  
     60    {  
     61          case Response::UNAUTHORIZED:  
     62              $response = $e->response($request);  
     63              $response->addHeader('WWW-Authenticate', 'Basic realm="Tonic"');  
     64              break;  
     65            
     66              default:  
     67                      $response = new Response($request);  
     68                      $response->code = Response::OK;  
     69                      $response->addHeader('content-type', 'application/json');  
     70                      if($request->id)  
     71                      {  
     72                              $body['id']     = $request->id;  
     73                      }  
     74                      $body['error'] = array("code" => "".$e->getCode(), "message" => $e->getMessage());  
     75                        
     76                      $response->body = json_encode($body);  
     77                        
     78                      //$response = $e->response($request); 
    5879    } 
    5980} 
     81 
    6082$response->output(); 
    6183 
  • branches/2.4/rest/setup/default_records.inc.php

    r6754 r7442  
    1515$oProc->query("INSERT INTO rest_client (client_id, client_secret) values (1, '$secret');"); 
    1616$dados = array(); 
    17 $oProc->query("select * from phpgw_config where config_app='phpgwapi'"); 
     17$oProc->query("SELECT * FROM phpgw_config WHERE config_app='phpgwapi'"); 
    1818while ($oProc->next_record()) 
    1919{ 
     
    3838$config['oauth']['client_secret'] = $secret; 
    3939 
     40$serverID = "001";  
     41$config['ServersRest-'.$serverID]['serverID'] = $serverID;  
     42$config['ServersRest-'.$serverID]['serverName'] = $_SERVER['HTTP_HOST'];  
     43$config['ServersRest-'.$serverID]['serverDescription'] = 'Expresso - ' . $_SERVER['HTTP_HOST'];  
     44$config['ServersRest-'.$serverID]['serverUrl'] = 'http://' . $_SERVER['HTTP_HOST'] . $dados['webserver_url'];  
     45$config['ServersRest-'.$serverID]['serverContext'] = '/rest/';  
     46$config['ServersRest-'.$serverID]['serverStatus'] = 'true';  
     47 
    4048Config::writeIniFile($config , dirname(__FILE__) . '/../../prototype/config/REST.ini', true); 
    41      
    4249 
    4350?> 
Note: See TracChangeset for help on using the changeset viewer.