should check permissions in method class not manager class
authorTony Mack <tmack@paris.CS.Princeton.EDU>
Tue, 16 Aug 2011 18:20:10 +0000 (14:20 -0400)
committerTony Mack <tmack@paris.CS.Princeton.EDU>
Tue, 16 Aug 2011 18:20:10 +0000 (14:20 -0400)
sfa/managers/registry_manager_pl.py
sfa/methods/Update.py

index 8bec1f6..9c74820 100644 (file)
@@ -174,6 +174,9 @@ def list(api, xrn, origin_hrn=None):
     return records
 
 
+def create_gid(api, xrn, cert):
+    pass
+
 def register(api, record):
 
     hrn, type = record['hrn'], record['type']
@@ -288,7 +291,6 @@ def update(api, record_dict):
     type = new_record['type']
     hrn = new_record['hrn']
     urn = hrn_to_urn(hrn,type)
-    api.auth.verify_object_permission(hrn)
     table = SfaTable()
     # make sure the record exists
     records = table.findObjects({'type': type, 'hrn': hrn})
index d36ea36..3624fc9 100644 (file)
@@ -31,6 +31,11 @@ class Update(Method):
     def call(self, record_dict, creds):
         # validate the cred
         valid_creds = self.api.auth.checkCredentials(creds, "update")
+        
+        # verify permissions 
+        api.auth.verify_object_permission(record.get('hrn', ''))
+    
+        # log
         origin_hrn = Credential(string=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, None, self.name))