Changeset 4f4b977
- Timestamp:
- Jun 26, 2008 5:55:10 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:
- 329f61d
- Parents:
- 5b8b886
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/fedd_proj.py
r5b8b886 r4f4b977 118 118 def get_users(self, obj): 119 119 """ 120 Return a list of the IDs of the users in obj120 Return a list of the IDs of the users in dict 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( req)248 247 msg.set_element_RequestAccessRequestBody( 248 pack_soap(msg, "RequestAccessRequestBody", req)) 249 249 try: 250 250 resp = port.RequestAccess(msg) 251 251 except ZSI.FaultException, e: 252 252 raise e.fault 253 return resp 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") 254 260 255 261 def permute_wildcards(self, a, p): … … 309 315 if req.has_key('project'): 310 316 p = req['project'] 311 project = unpack_id(p['name']) 317 if p.has_key('name'): 318 project = unpack_id(p['name']) 312 319 user = self.get_users(p) 313 320 else: … … 366 373 return found, (dyn_user, dyn_proj) 367 374 368 def build_response(self, resp,alloc_id, ap, ssh):375 def build_response(self, alloc_id, ap, ssh): 369 376 """ 370 377 Create the SOAP response. … … 398 405 [ { 'attribute': x, 'value' : y } \ 399 406 for x,y in self.attrs.iteritems()] 407 return msg 408 409 410 def soap_RequestAccess(self, ps, fid): 411 req = ps.Parse(RequestAccessRequestMessage.typecode) 412 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() 400 420 401 421 resp.set_element_RequestAccessResponseBody( 402 422 pack_soap(resp, "RequestAccessResponseBody", msg)) 403 404 def soap_RequestAccess(self, ps, fid): 405 req = ps.Parse(RequestAccessRequestMessage.typecode) 406 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() 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']) 415 434 435 print dt 436 416 437 if dt == None or dt == self.testbed: 417 # Request for this fedd (shift to dictionary representation) 418 r = unpack_soap(req) 419 420 found, dyn = self.lookup_access(r, fid) 438 # Request for this fedd 439 found, dyn = self.lookup_access(req, fid) 421 440 422 441 # Check for access to restricted nodes 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') \ 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 \ 428 446 for t in n['hardware'] \ 429 447 if t in self.restricted and \ … … 435 453 436 454 ssh = [ x['sshPubkey'] \ 437 for x in r ['access'] if x.has_key('sshPubkey')]455 for x in req['access'] if x.has_key('sshPubkey')] 438 456 439 457 if len(ssh) > 0: … … 443 461 raise Fault(Fault.Client, "SSH access parameters required") 444 462 445 resp = RequestAccessResponseMessage() 446 self.build_response(resp, r['allocID'], found, ssh) 463 resp = self.build_response(req['allocID'], found, ssh) 447 464 return resp 448 465 else: 449 466 # Proxy the request 450 467 return self.proxy_request(dt, req) 451 452 468 453 469 def read_trust(self, trust):
Note: See TracChangeset
for help on using the changeset viewer.