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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 738 - (show annotations)
Thu Aug 21 21:45:51 2008 UTC (13 years ago) by richard.p.wagner
File size: 3637 byte(s)
added simple authorization mechanism
1 <?php
2
3 require_once('config.inc');
4
5 require_once(BACKEND.'node.php');
6 require_once(BACKEND.'vospace.php');
7
8
9 class VOSpaceService {
10
11 private $vospace;
12
13 function __construct(){
14 $this->vospace = new VOSpace();
15 }
16
17 function GetViews($message){
18 if($this->vospace->getAuthorization('GetViews') == False){
19 throw new SoapFault("Server", "Permission denied.", " ",
20 array(), "PermissionDenied");
21 }
22
23 $views = $this->vospace->getViews();
24 return $views;
25 }
26
27 function GetProtocols($message){
28 if($this->vospace->getAuthorization('GetProtocols') == False){
29 throw new SoapFault("Server", "Permission denied.", " ",
30 array(), "PermissionDenied");
31 }
32
33 $protocols = $this->vospace->getProtocols();
34 return $protocols;
35 }
36
37 function GetProperties(){
38 if($this->vospace->getAuthorization('GetProperties') == False){
39 throw new SoapFault("Server", "Permission denied.", " ",
40 array(), "PermissionDenied");
41 }
42
43 $properties = $this->vospace->getProperties();
44 return $properties;
45 }
46
47 function CreateNode($message)
48 {
49
50 return $data;
51
52 }
53
54 function DeleteNode($message)
55 {
56
57 return $data;
58
59 }
60
61 function MoveNode($message)
62 {
63
64 return $data;
65
66 }
67
68 function CopyNode($message)
69 {
70
71
72 return $data;
73
74 }
75
76 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);
84
85 if(!$node->exists()){
86 $bad_target = $target->target;
87 throw new SoapFault("Server", "Node not found.", " ",
88 array("uri" => $bad_target),
89 "NodeNotFoundFault");
90 }
91
92 $node->populateProperties();
93 return array('node' => $node);
94 }
95
96 function SetNode($message)
97 {
98
99
100 return $data;
101
102 }
103
104 function ListNodes($node_list_req){
105
106 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");
112 $node_list = $this->vospace->listNodes($node_list_req->request);
113
114 if($node_list['nodes'] == Null){
115 throw new SoapFault("Server", "Node not found.", " ",
116 array("uri" => $node_list_req->request->nodes->node->uri),
117 "NodeNotFoundFault");
118 }
119
120 return array('response' => $node_list);
121 }
122
123 function FindNodes($message)
124 {
125
126 return $data;
127
128 }
129
130 function PushToVoSpace($message)
131 {
132
133 return $data;
134
135 }
136
137 function PullToVoSpace($message)
138 {
139
140 return $data;
141
142 }
143
144 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);
152
153 if(!$node->exists()){
154 $bad_target = $request->source;
155 throw new SoapFault("Server", "Node not found.", " ",
156 array("uri" => $bad_target),
157 "NodeNotFoundFault");
158 }
159
160 $view = $node->getView();
161 $protocols = $node->getProtocols();
162
163 // transfer element, with at least a view and protocol element
164 $response = array('transfer'=>
165 array('view' => $view,
166 'protocol' => $protocols));
167
168 return $response;
169 }
170
171 function PushFromVoSpace($message){
172 throw new SoapFault("Server", "Not implemented.", " ",
173 array(), "InternalFault");
174 }
175
176 function Security( $wsse_header ){
177 $this->vospace->getAuthInfo($wsse_header);
178 }
179 }
180
181 ?>

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