@@ -441,6 +441,7 @@ class Meta:
441441
442442 user_external_id = UnicodeAttribute (hash_key = True )
443443
444+
444445class FoundationSfidIndex (GlobalSecondaryIndex ):
445446 """
446447 This class represents a global secondary index for querying mapping of cla-groups and projects by foundation_sfid
@@ -452,9 +453,10 @@ class Meta:
452453 write_capacity_units = int (cla .conf ["DYNAMO_WRITE_UNITS" ])
453454 read_capacity_units = int (cla .conf ["DYNAMO_READ_UNITS" ])
454455 projection = AllProjection ()
455-
456+
456457 foundation_sfid = UnicodeAttribute (hash_key = True )
457458
459+
458460class CLAGroupIDIndex (GlobalSecondaryIndex ):
459461 """
460462 This class represents a global secondary index for querying by cla-group-id
@@ -466,7 +468,7 @@ class Meta:
466468 write_capacity_units = int (cla .conf ["DYNAMO_WRITE_UNITS" ])
467469 read_capacity_units = int (cla .conf ["DYNAMO_READ_UNITS" ])
468470 projection = AllProjection ()
469-
471+
470472 cla_group_id = UnicodeAttribute (hash_key = True )
471473
472474
@@ -917,7 +919,7 @@ class Meta:
917919
918920 project_acl = UnicodeSetAttribute (default = set ())
919921 # Default is v1 for all of our models - override for this model so that we can redirect to new UI when ready
920- #version = UnicodeAttribute(default="v2") # Schema version is v2 for Project Models
922+ # version = UnicodeAttribute(default="v2") # Schema version is v2 for Project Models
921923
922924
923925class Project (model_interfaces .Project ): # pylint: disable=too-many-public-methods
@@ -1636,7 +1638,7 @@ def preprocess_pattern(self, emails, patterns) -> bool:
16361638 preprocessed_pattern = "^.*@" + pattern + "$"
16371639 pat = re .compile (preprocessed_pattern )
16381640 for email in emails :
1639- if pat .match (email ) != None :
1641+ if pat .match (email ) is not None :
16401642 self .log_debug ("found user email in email whitelist pattern" )
16411643 return True
16421644 return False
@@ -1779,7 +1781,7 @@ def all(self, emails=None):
17791781 if emails is None :
17801782 users = self .model .scan ()
17811783 else :
1782- users = UserModel .batch_get (emails )
1784+ users = UserModel .batch_get (emails )
17831785 ret = []
17841786 for user in users :
17851787 usr = User ()
@@ -1999,6 +2001,11 @@ class Meta:
19992001 signature_reference_type = UnicodeAttribute ()
20002002 signature_type = UnicodeAttribute (default = "cla" )
20012003 signature_signed = BooleanAttribute (default = False )
2004+ # Signed on date/time
2005+ signed_on = UnicodeAttribute (null = True )
2006+ # Encoded string for searching
2007+ # eg: icla#true#true#123abd-sadf0-458a-adba-a9393939393
2008+ sigtype_signed_approved_id = UnicodeAttribute (null = True )
20022009 signature_approved = BooleanAttribute (default = False )
20032010 signature_sign_url = UnicodeAttribute (null = True )
20042011 signature_return_url = UnicodeAttribute (null = True )
@@ -2023,12 +2030,17 @@ class Meta:
20232030 signature_company_initial_manager_index = SignatureCompanyInitialManagerIndex ()
20242031 project_signature_external_id_index = SignatureProjectExternalIndex ()
20252032
2026- # whitelists are only used by CCLAs
2033+ # approval lists (previously called whitelists) are only used by CCLAs
20272034 domain_whitelist = ListAttribute (null = True )
20282035 email_whitelist = ListAttribute (null = True )
20292036 github_whitelist = ListAttribute (null = True )
20302037 github_org_whitelist = ListAttribute (null = True )
20312038
2039+ # Additional attributes for ICLAs
2040+ user_email = UnicodeAttribute (null = True )
2041+ user_github_username = UnicodeAttribute (null = True )
2042+ user_name = UnicodeAttribute (null = True )
2043+
20322044
20332045class Signature (model_interfaces .Signature ): # pylint: disable=too-many-public-methods
20342046 """
@@ -2048,6 +2060,8 @@ def __init__(
20482060 signature_type = None ,
20492061 signature_signed = False ,
20502062 signature_approved = False ,
2063+ signed_on = None ,
2064+ sigtype_signed_approved_id = None ,
20512065 signature_sign_url = None ,
20522066 signature_return_url = None ,
20532067 signature_callback_url = None ,
@@ -2067,7 +2081,10 @@ def __init__(
20672081 signature_company_initial_manager_id = None ,
20682082 signature_company_initial_manager_name = None ,
20692083 signature_company_initial_manager_email = None ,
2070- signature_company_secondary_manager_list = None
2084+ signature_company_secondary_manager_list = None ,
2085+ user_email = None ,
2086+ user_github_username = None ,
2087+ user_name = None
20712088 ):
20722089 super (Signature ).__init__ ()
20732090 self .model = SignatureModel ()
@@ -2083,6 +2100,8 @@ def __init__(
20832100 self .model .signature_reference_type = signature_reference_type
20842101 self .model .signature_type = signature_type
20852102 self .model .signature_signed = signature_signed
2103+ self .model .signed_on = signed_on
2104+ self .model .sigtype_signed_approved_id = sigtype_signed_approved_id
20862105 self .model .signature_approved = signature_approved
20872106 self .model .signature_sign_url = signature_sign_url
20882107 self .model .signature_return_url = signature_return_url
@@ -2103,17 +2122,22 @@ def __init__(
21032122 self .model .signature_company_initial_manager_name = signature_company_initial_manager_name
21042123 self .model .signature_company_initial_manager_email = signature_company_initial_manager_email
21052124 self .model .signature_company_secondary_manager_list = signature_company_secondary_manager_list
2125+ self .model .user_email = user_email
2126+ self .model .user_github_username = user_github_username
2127+ self .model .user_name = user_name
21062128
21072129 def __str__ (self ):
21082130 return (
21092131 "id: {}, project id: {}, reference id: {}, reference name: {}, reference name lower: {}, "
21102132 "reference type: {}, "
2111- "user cla company id: {}, signed: {}, approved: {}, domain whitelist: {}, "
2133+ "user cla company id: {}, signed: {}, signed_on: {}, sigtype_signed_approved_id: {}, "
2134+ "approved: {}, domain whitelist: {}, "
21122135 "email whitelist: {}, github user whitelist: {}, github domain whitelist: {}, "
21132136 "note: {},signature project external id: {}, signature company signatory id: {}, "
21142137 "signature company signatory name: {}, signature company signatory email: {},"
21152138 "signature company initial manager id: {}, signature company initial manager name: {},"
2116- "signature company initial manager email: {}, signature company secondary manager list: {}"
2139+ "signature company initial manager email: {}, signature company secondary manager list: {},"
2140+ "user_email: {}, user_github_username: {}, user_name: {}"
21172141 ).format (
21182142 self .model .signature_id ,
21192143 self .model .signature_project_id ,
@@ -2123,6 +2147,8 @@ def __str__(self):
21232147 self .model .signature_reference_type ,
21242148 self .model .signature_user_ccla_company_id ,
21252149 self .model .signature_signed ,
2150+ self .model .signed_on ,
2151+ self .model .sigtype_signed_approved_id ,
21262152 self .model .signature_approved ,
21272153 self .model .domain_whitelist ,
21282154 self .model .email_whitelist ,
@@ -2136,7 +2162,10 @@ def __str__(self):
21362162 self .model .signature_company_initial_manager_id ,
21372163 self .model .signature_company_initial_manager_name ,
21382164 self .model .signature_company_initial_manager_email ,
2139- self .model .signature_company_secondary_manager_list
2165+ self .model .signature_company_secondary_manager_list ,
2166+ self .model .user_email ,
2167+ self .model .user_github_username ,
2168+ self .model .user_name
21402169 )
21412170
21422171 def to_dict (self ):
@@ -2176,6 +2205,12 @@ def get_signature_type(self):
21762205 def get_signature_signed (self ):
21772206 return self .model .signature_signed
21782207
2208+ def get_signed_on (self ):
2209+ return self .model .signed_on
2210+
2211+ def get_sigtype_signed_approved_id (self ):
2212+ return self .model .sigtype_signed_approved_id
2213+
21792214 def get_signature_approved (self ):
21802215 return self .model .signature_approved
21812216
@@ -2252,6 +2287,15 @@ def get_signature_company_secondary_manager_list(self):
22522287 def get_signature_project_external_id (self ):
22532288 return self .model .signature_project_external_id
22542289
2290+ def get_user_email (self ):
2291+ return self .model .user_email
2292+
2293+ def get_user_github_username (self ):
2294+ return self .model .user_github_username
2295+
2296+ def get_user_name (self ):
2297+ return self .model .user_name
2298+
22552299 def set_signature_id (self , signature_id ):
22562300 self .model .signature_id = str (signature_id )
22572301
@@ -2273,6 +2317,12 @@ def set_signature_type(self, signature_type):
22732317 def set_signature_signed (self , signed ):
22742318 self .model .signature_signed = bool (signed )
22752319
2320+ def set_signed_on (self , signed_on ):
2321+ self .model .signed_on = signed_on
2322+
2323+ def set_sigtype_signed_approved_id (self , sigtype_signed_approved_id ):
2324+ self .model .sigtype_signed_approved_id = sigtype_signed_approved_id
2325+
22762326 def set_signature_approved (self , approved ):
22772327 self .model .signature_approved = bool (approved )
22782328
@@ -2355,6 +2405,15 @@ def remove_signature_acl(self, username):
23552405 if username in self .model .signature_acl :
23562406 self .model .signature_acl .remove (username )
23572407
2408+ def set_user_email (self , user_email ):
2409+ self .model .user_email = user_email
2410+
2411+ def set_user_github_username (self , user_github_username ):
2412+ self .model .user_github_username = user_github_username
2413+
2414+ def set_user_name (self , user_name ):
2415+ self .model .user_name = user_name
2416+
23582417 def get_signatures_by_reference (
23592418 self , # pylint: disable=too-many-arguments
23602419 reference_id ,
@@ -2503,8 +2562,9 @@ def get_ccla_signatures_by_company_project(self, company_id, project_id):
25032562 signature = Signature ()
25042563 signature .model = signature_model
25052564 signatures .append (signature )
2506- cla .log .info (f'Returning %d signatures for project_id: %s and company_id: %s' ,
2507- len (signatures ), project_id , company_id )
2565+ cla .log .info (f'Returning { len (signatures )} signatures for '
2566+ f'project_id: { project_id } and '
2567+ f'company_id: { company_id } ' )
25082568 return signatures
25092569
25102570 def get_employee_signatures_by_company_project (self , company_id , project_id ):
@@ -2665,17 +2725,17 @@ def __str__(self):
26652725
26662726 def to_dict (self ):
26672727 return dict (self .model )
2668-
2728+
26692729 def save (self ):
26702730 return self .model .save ()
2671-
2731+
26722732 def load (self , project_sfid ):
26732733 try :
26742734 project_cla_group = self .model .get (project_sfid )
26752735 except ProjectCLAGroupModel .DoesNotExist :
26762736 raise cla .models .DoesNotExist ("projectCLAGroup does not exist" )
26772737 self .model = project_cla_group
2678-
2738+
26792739 def delete (self ):
26802740 self .model .delete ()
26812741
@@ -2741,7 +2801,7 @@ def get_by_foundation_sfid(self, foundation_sfid):
27412801 proj_cla_group .model = project_cla_group
27422802 ret .append (proj_cla_group )
27432803 return ret
2744-
2804+
27452805 def get_by_cla_group_id (self , cla_group_id ):
27462806 project_cla_groups = ProjectCLAGroupModel .cla_group_id_index .query (cla_group_id )
27472807 ret = []
@@ -3058,7 +3118,7 @@ def __init__(
30583118 super (GitHubOrg ).__init__ ()
30593119 self .model = GitHubOrgModel ()
30603120 self .model .organization_name = organization_name
3061- if self .model .organization_name :
3121+ if self .model .organization_name :
30623122 self .model .organization_name_lower = self .model .organization_name .lower ()
30633123 self .model .organization_installation_id = organization_installation_id
30643124 self .model .organization_sfid = organization_sfid
@@ -3432,6 +3492,7 @@ class Meta:
34323492 event_project_name = UnicodeAttribute (null = True )
34333493 event_project_name_lower = UnicodeAttribute (null = True )
34343494 event_user_name = UnicodeAttribute (null = True )
3495+ event_user_name_lower = UnicodeAttribute (null = True )
34353496 event_time = UTCDateTimeAttribute (default = datetime .datetime .now ())
34363497 event_time_epoch = NumberAttribute (default = int (time .time ()))
34373498 event_data = UnicodeAttribute (null = True )
@@ -3558,12 +3619,6 @@ def get_event_user_name(self):
35583619 def get_event_user_name_lower (self ):
35593620 return self .model .event_user_name_lower
35603621
3561- def get_event_project_name (self ):
3562- return self .model .event_project_name
3563-
3564- def get_event_project_name_lower (self ):
3565- return self .model .event_project_name_lower
3566-
35673622 def get_event_project_external_id (self ):
35683623 return self .model .event_project_external_id
35693624
@@ -3625,7 +3680,8 @@ def set_event_date_and_contains_pii(self, contains_pii=False):
36253680
36263681 def set_company_id_external_project_id (self ):
36273682 if self .model .event_project_external_id is not None and self .model .event_company_id is not None :
3628- self .model .company_id_external_project_id = '{}#{}' .format (self .model .event_company_id ,self .model .event_project_external_id )
3683+ self .model .company_id_external_project_id = (f'{ self .model .event_company_id } '
3684+ f'#{ self .model .event_project_external_id } ' )
36293685
36303686 def search_events (self , ** kwargs ):
36313687 """
0 commit comments