Robustify in face of new affiliation: "Collaboration"
authorDan Scott <dscott@laurentian.ca>
Thu, 29 Aug 2019 17:00:18 +0000 (13:00 -0400)
committerDan Scott <dan@coffeecode.net>
Thu, 29 Aug 2019 17:22:53 +0000 (13:22 -0400)
Also map "Collaboration" to the same as "Affiliate" (Staff).

Signed-off-by: Dan Scott <dscott@laurentian.ca>
tools/patron-load/ldap_osrf_sync

index ebd1725..1bc53fc 100755 (executable)
@@ -187,6 +187,7 @@ class User:
             'proxy': None,
             'retired': None,
             'affiliate': 115,
+            'collaboration': 115,
             'visitor': 113
         }
 
@@ -204,11 +205,14 @@ class User:
                             self.affiliation = 'gr'
                         else:
                             self.affiliation = 'ug'
+                    else:
+                        self.affiliation = affiliation
                 else:
-                    self.affiliation = affiliation
+                    print >> sys.stderr, "Affiliation '%s' not mapped to a profile " \
+                        "for user %s" % (affiliation, self.ldap_atts)
 
         if hasattr(self, 'affiliation'):
-            return profile_map[affiliation]
+            return profile_map[self.affiliation]
 
         if  'empl' in self.cname.lower():
             affiliation = 'staff'