pass options to auth.check
Tony Mack [Thu, 22 May 2014 02:37:46 +0000 (22:37 -0400)]
sfa/methods/Allocate.py
sfa/methods/ListResources.py
sfa/methods/Provision.py
sfa/methods/Renew.py
sfa/methods/Status.py

index ff543b7..f255232 100644 (file)
@@ -37,10 +37,9 @@ class Allocate(Method):
     def call(self, xrn, creds, rspec, options):
         xrn = Xrn(xrn, type='slice')
         self.api.logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, xrn.get_hrn(), self.name))
-        (speaking_for, _) = urn_to_hrn(options.get('geni_speaking_for'))
 
         # Find the valid credentials
-        valid_creds = self.api.auth.checkCredentials(creds, 'createsliver', xrn.get_hrn(), speaking_for_hrn=speaking_for)
+        valid_creds = self.api.auth.checkCredentials(creds, 'createsliver', xrn.get_hrn(), options=options)
         # use the expiration from the first valid credential to determine when 
         # the slivers should expire.
         expiration = datetime_to_string(Credential(cred=valid_creds[0]).expiration)
index a9ffe76..e7f1631 100644 (file)
@@ -33,10 +33,8 @@ class ListResources(Method):
             else:
                 raise SfaInvalidArgument('Must specify an rspec version option. geni_rspec_version cannot be null')
 
-        (speaking_for, _) = urn_to_hrn(options.get('geni_speaking_for'))
         # Find the valid credentials
-        valid_creds = self.api.auth.checkCredentials(creds, 'listnodes', speaking_for_hrn=speaking_for)
+        valid_creds = self.api.auth.checkCredentials(creds, 'listnodes', options=options)
 
         # get hrn of the original caller 
         origin_hrn = options.get('origin_hrn', None)
index a3fd0fe..578f6d2 100644 (file)
@@ -36,7 +36,7 @@ class Provision(Method):
         # Find the valid credentials
         valid_creds = self.api.auth.checkCredentials(creds, 'createsliver', xrns,
                       check_sliver_callback = self.api.driver.check_sliver_credentials,
-                      speaking_for_hrn=speaking_for) 
+                      options=options) 
         origin_hrn = Credential(cred=valid_creds[0]).get_gid_caller().get_hrn()
         self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, xrns, self.name))
         result = self.api.manager.Provision(self.api, xrns, creds, options)
index 7b470f1..5aef457 100644 (file)
@@ -32,12 +32,10 @@ class Renew(Method):
 
         self.api.logger.info("interface: %s\ttarget-hrn: %s\tcaller-creds: %s\tmethod-name: %s"%(self.api.interface, urns, creds, self.name))
 
-        (speaking_for, _) = urn_to_hrn(options.get('geni_speaking_for'))
-    
         # Find the valid credentials
         valid_creds = self.api.auth.checkCredentials(creds, 'renewsliver', urns,
                       check_sliver_callback = self.api.driver.check_sliver_credentials,
-                      speaking_for_hrn=speaking_for)
+                      options=options)
 
         # Validate that the time does not go beyond the credential's expiration time
         requested_time = utcparse(expiration_time)
index 36da58e..76e967d 100644 (file)
@@ -19,10 +19,9 @@ class Status(Method):
     returns = Parameter(dict, "Status details")
 
     def call(self, xrns, creds, options):
-        (speaking_for, _) = urn_to_hrn(options.get('geni_speaking_for'))
         valid_creds = self.api.auth.checkCredentials(creds, 'sliverstatus', xrns,
                       check_sliver_callback = self.api.driver.check_sliver_credentials,
-                      speaking_for_hrn=speaking_for)
+                      options=options)
 
         self.api.logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, xrns, self.name))
         return self.api.manager.Status(self.api, xrns, creds, options)