- Timestamp:
- Jun 26, 2008 3:16:21 PM (16 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
- Children:
- 4f4b977
- Parents:
- 2d58549
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/fedd_proj.py
r2d58549 r5b8b886 118 118 def get_users(self, obj): 119 119 """ 120 Return a list of the IDs of the users in dict120 Return a list of the IDs of the users in obj 121 121 """ 122 122 if obj.has_key('user'): 123 123 return [ unpack_id(u['userID']) \ 124 for u in obj['user'] if u.has_key('userID') 124 for u in obj['user'] if u.has_key('userID')] 125 125 else: 126 126 return None … … 245 245 # Reconstruct the full request message 246 246 msg = RequestAccessRequestMessage() 247 msg.set_element_RequestAccessRequestBody( 248 pack_soap(msg, "RequestAccessRequestBody", req)) 247 msg.set_element_RequestAccessRequestBody(req) 248 249 249 try: 250 250 resp = port.RequestAccess(msg) 251 251 except ZSI.FaultException, e: 252 252 raise e.fault 253 254 r = unpack_soap(resp) 255 256 if r.has_key('RequestAccessResponseBody'): 257 return r['RequestAccessResponseBody'] 258 else: 259 raise Fault(Fault.Server, "Bad proxy response") 253 return resp 260 254 261 255 def permute_wildcards(self, a, p): … … 315 309 if req.has_key('project'): 316 310 p = req['project'] 317 if p.has_key('name'): 318 project = unpack_id(p['name']) 311 project = unpack_id(p['name']) 319 312 user = self.get_users(p) 320 313 else: … … 373 366 return found, (dyn_user, dyn_proj) 374 367 375 def build_response(self, alloc_id, ap, ssh):368 def build_response(self, resp, alloc_id, ap, ssh): 376 369 """ 377 370 Create the SOAP response. … … 405 398 [ { 'attribute': x, 'value' : y } \ 406 399 for x,y in self.attrs.iteritems()] 407 return msg 408 400 401 resp.set_element_RequestAccessResponseBody( 402 pack_soap(resp, "RequestAccessResponseBody", msg)) 409 403 410 404 def soap_RequestAccess(self, ps, fid): 411 405 req = ps.Parse(RequestAccessRequestMessage.typecode) 412 406 413 414 #if req == None: raise Fault(Fault.Client, "No request??") 415 #req = req.get_element_RequestAccessRequestBody() 416 # if req == None: raise Fault(Fault.Client, "No request body??") 417 418 msg = self.RequestAccess(unpack_soap(req), fedid) 419 resp = RequestAccessResponseMessage() 420 421 resp.set_element_RequestAccessResponseBody( 422 pack_soap(resp, "RequestAccessResponseBody", msg)) 423 return resp 424 425 def RequestAccess(self, req, fid): 426 427 if req.has_key('RequestAccessRequestBody'): 428 req = req['RequestAccessRequestBody'] 429 else: 430 raise Fault(Fault.Client, "No request!?") 431 432 if req.has_key('destinationTestbed'): 433 dt = unpack_id(req['destinationTestbed']) 407 if req == None: raise Fault(Fault.Client, "No request??") 408 req = req.get_element_RequestAccessRequestBody() 409 if req == None: raise Fault(Fault.Client, "No request body??") 410 411 412 dt = req.get_element_destinationTestbed() 413 414 if dt != None: dt = dt.get_element_uri() 434 415 435 print dt436 437 416 if dt == None or dt == self.testbed: 438 # Request for this fedd 439 found, dyn = self.lookup_access(req, fid) 417 # Request for this fedd (shift to dictionary representation) 418 r = unpack_soap(req) 419 420 found, dyn = self.lookup_access(r, fid) 440 421 441 422 # Check for access to restricted nodes 442 if req.has_key('resources') and req['resources'].has_key('node'): 443 resources = req['resources'] 444 inaccessible = [ t for n in resources['node'] \ 445 if n.has_key('hardware') != None \ 423 if r.has_key('resources') and r['resources'].has_key('node'): 424 425 resources = r['resources'] 426 inaccessible = [ t for n in resources['node']\ 427 if n.has_key('hardware') \ 446 428 for t in n['hardware'] \ 447 429 if t in self.restricted and \ … … 453 435 454 436 ssh = [ x['sshPubkey'] \ 455 for x in r eq['access'] if x.has_key('sshPubkey')]437 for x in r['access'] if x.has_key('sshPubkey')] 456 438 457 439 if len(ssh) > 0: … … 461 443 raise Fault(Fault.Client, "SSH access parameters required") 462 444 463 resp = self.build_response(req['allocID'], found, ssh) 445 resp = RequestAccessResponseMessage() 446 self.build_response(resp, r['allocID'], found, ssh) 464 447 return resp 465 448 else: 466 449 # Proxy the request 467 450 return self.proxy_request(dt, req) 451 468 452 469 453 def read_trust(self, trust):
Note: See TracChangeset
for help on using the changeset viewer.