deprecate the is_enabled call in the driver
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 9 May 2012 15:24:30 +0000 (17:24 +0200)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 9 May 2012 15:24:30 +0000 (17:24 +0200)
this was useless given that we import only enabled users

sfa/managers/driver.py
sfa/managers/registry_manager.py
sfa/plc/pldriver.py

index f48964f..cdd6fae 100644 (file)
@@ -13,12 +13,9 @@ class Driver:
     ########## registry oriented
     ########################################
 
-    # redefine this if you want to check again records 
-    # when running GetCredential
-    # This is to reflect the 'enabled' user field in planetlab testbeds
-    # expected retcod boolean
-    def is_enabled (self, record) : 
-        return True
+    # NOTE: the is_enabled method is deprecated
+    # it was only making things confusing, as the (PL) import mechanism would
+    # ignore not enabled users anyway..
 
     # the following is used in Resolve (registry) when run in full mode
     #     after looking up the sfa db, we wish to be able to display
index 87a2c9e..01c6203 100644 (file)
@@ -53,14 +53,13 @@ class RegistryManager:
         record=dbsession.query(RegRecord).filter_by(type=type,hrn=hrn).first()
         if not record:
             raise RecordNotFound("hrn=%s, type=%s"%(hrn,type))
-    
-        # verify_cancreate_credential requires that the member lists
-        # (researchers, pis, etc) be filled in
-        logger.debug("get credential before augment dict, keys=%s"%record.__dict__.keys())
-        self.driver.augment_records_with_testbed_info (record.__dict__)
-        logger.debug("get credential after augment dict, keys=%s"%record.__dict__.keys())
-        if not self.driver.is_enabled (record.__dict__):
-              raise AccountNotEnabled(": PlanetLab account %s is not enabled. Please contact your site PI" %(record.email))
+
+        # xxx for the record only
+        # used to call this, which was wrong, now all needed data is natively is our DB
+        # self.driver.augment_records_with_testbed_info (record.__dict__)
+        # likewise, we deprecate is_enabled which was not really useful
+        # if not self.driver.is_enabled (record.__dict__): ...
+        # xxx for the record only
     
         # get the callers gid
         # if caller_xrn is not specified assume the caller is the record
index 8cf21d9..33ec00d 100644 (file)
@@ -60,14 +60,6 @@ class PlDriver (Driver):
     ########## registry oriented
     ########################################
 
-    ########## disabled users 
-    def is_enabled (self, record):
-        # the incoming record was augmented already, so 'enabled' should be set
-        if record['type'] == 'user':
-            return record['enabled']
-        # only users can be disabled
-        return True
-
     def augment_records_with_testbed_info (self, sfa_records):
         return self.fill_record_info (sfa_records)