/[volute]/trunk/projects/grid/vospace/php_endpoint/vospace_service.php
ViewVC logotype

Diff of /trunk/projects/grid/vospace/php_endpoint/vospace_service.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 737 by richard.p.wagner, Thu Aug 21 19:31:18 2008 UTC revision 738 by richard.p.wagner, Thu Aug 21 21:45:51 2008 UTC
# Line 8  Line 8 
8    
9  class VOSpaceService {  class VOSpaceService {
10    
11      private $vospace;
12    
13      function __construct(){
14        $this->vospace = new VOSpace();
15      }
16    
17    function GetViews($message){    function GetViews($message){
18      $vospace = new VOSpace();      if($this->vospace->getAuthorization('GetViews') == False){
19      $views = $vospace->getViews();        throw new SoapFault("Server", "Permission denied.", " ",
20                              array(), "PermissionDenied");
21        }
22        
23        $views = $this->vospace->getViews();
24      return $views;      return $views;
25    }    }
26    
27    function GetProtocols($message){        function GetProtocols($message){    
28      $vospace = new VOSpace();      if($this->vospace->getAuthorization('GetProtocols') == False){
29      $protocols = $vospace->getProtocols();        throw new SoapFault("Server", "Permission denied.", " ",
30                              array(), "PermissionDenied");
31        }
32    
33        $protocols = $this->vospace->getProtocols();
34      return $protocols;      return $protocols;
35    }    }
36    
37    function GetProperties(){    function GetProperties(){
38      $vospace = &new VOSpace();      if($this->vospace->getAuthorization('GetProperties') == False){
39      $properties = $vospace->getProperties();        throw new SoapFault("Server", "Permission denied.", " ",
40                              array(), "PermissionDenied");
41        }
42    
43        $properties = $this->vospace->getProperties();
44      return $properties;      return $properties;
45    }    }
46    
# Line 57  Line 75 
75    
76    function GetNode($target)    function GetNode($target)
77    {    {
78        if($this->vospace->getAuthorization('GetNode') == False){
79          throw new SoapFault("Server", "Permission denied.", " ",
80                              array(), "PermissionDenied");
81        }
82    
83      $node = new Node($target->target);      $node = new Node($target->target);
84            
# Line 81  Line 103 
103    
104    function ListNodes($node_list_req){    function ListNodes($node_list_req){
105    
106      $vospace = &new VOSpace();      if($this->vospace->getAuthorization('ListNodes') == False){
107          throw new SoapFault("Server", "Permission denied.", " ",
108                              array(), "PermissionDenied");
109        }
110    
111      //    error_log(var_export($node_list_req, True), 3, "/var/tmp/my-errors.log");      //    error_log(var_export($node_list_req, True), 3, "/var/tmp/my-errors.log");
112      $node_list = $vospace->listNodes($node_list_req->request);      $node_list = $this->vospace->listNodes($node_list_req->request);
113    
114      if($node_list['nodes'] == Null){      if($node_list['nodes'] == Null){
115        throw new SoapFault("Server", "Node not found.", " ",        throw new SoapFault("Server", "Node not found.", " ",
# Line 117  Line 143 
143    
144    function PullFromVoSpace($request)    function PullFromVoSpace($request)
145    {    {
146        if($this->vospace->getAuthorization('PullFromVoSpace') == False){
147          throw new SoapFault("Server", "Permission denied.", " ",
148                              array(), "PermissionDenied");
149        }
150    
151      $node = new Node($request->source);      $node = new Node($request->source);
152            
153      if(!$node->exists()){      if(!$node->exists()){
# Line 139  Line 170 
170    
171    function PushFromVoSpace($message){    function PushFromVoSpace($message){
172        throw new SoapFault("Server", "Not implemented.", " ",        throw new SoapFault("Server", "Not implemented.", " ",
173                            array(),                            array(), "InternalFault");
                           "InternalFault");  
174    }    }
175    
176    function Security( $foo ){    function Security( $wsse_header ){
177        $this->vospace->getAuthInfo($wsse_header);    
     $p = xml_parser_create();  
     xml_parse_into_struct($p, $foo->any, $vals, $index);  
     xml_parser_free($p);  
 //     error_log(var_export($vals, True), 3, "/var/tmp/vospace.err.log");  
 //     error_log(var_export($index, True), 3, "/var/tmp/vospace.err.log");  
   
     $username = '';  
     $password = '';  
     foreach( $vals as $element){  
       if( strpos($element['tag'],  "USERNAMETOKEN") === FALSE ){  
         if( strpos($element['tag'],  "USERNAME") !== FALSE )  
           $username = $element['value'];  
         if( strpos($element['tag'],  "PASSWORD") !== FALSE )  
           $password = $element['value'];  
       }  
     }  
     error_log(var_export($username, True), 3, "/var/tmp/vospace.err.log");  
     error_log(var_export($password, True), 3, "/var/tmp/vospace.err.log");  
   
     if( $username == 'joe' && $password == 'doe' ){  
       $this->Authenticated = True;  
     } else {  
       $this->Authenticated = False;  
        throw new SoapFault("Server", "Not authenticated.", " ",  
                            array(),  
                            "PermissionDeniedFault");  
         
     }  
178    }    }
179  }  }
180    

Legend:
Removed from v.737  
changed lines
  Added in v.738

msdemlei@ari.uni-heidelberg.de
ViewVC Help
Powered by ViewVC 1.1.26