Skip to content

Commit 3548a0e

Browse files
Debug issue
Signed-off-by: Lukasz Gryglicki <[email protected]>
1 parent 5882b34 commit 3548a0e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

cla-backend/cla/models/dynamo_models.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,6 +2013,7 @@ def preprocess_pattern(self, emails, patterns) -> bool:
20132013
:rtype: bool
20142014
"""
20152015
fn = 'dynamo_models.preprocess_pattern'
2016+
cla.log.debug(f"{fn}: LG: self={self}, emails={emails}, patterns={patterns}")
20162017
for pattern in patterns:
20172018
if pattern.startswith("*."):
20182019
pattern = pattern.replace("*.", ".*")
@@ -2023,10 +2024,12 @@ def preprocess_pattern(self, emails, patterns) -> bool:
20232024

20242025
preprocessed_pattern = "^.*@" + pattern + "$"
20252026
pat = re.compile(preprocessed_pattern)
2027+
cla.log.debug(f"{fn}: LG: patters={pattern}, preprocessed_pattern={preprocessed_pattern}, pat={pat}")
20262028
for email in emails:
20272029
if pat.match(email) is not None:
20282030
self.log_debug(f'{fn} - found user email in email approval pattern')
20292031
return True
2032+
cla.log.debug(f"{fn}: LG: no match")
20302033
return False
20312034

20322035
# Accepts a Signature object
@@ -2042,11 +2045,14 @@ def is_approved(self, ccla_signature: Signature) -> bool:
20422045
:rtype: bool
20432046
"""
20442047
fn = 'dynamo_models.is_approved'
2048+
cla.log.debug(f"{fn}: LG: self={self}, ccla_signature={ccla_signature}")
20452049
# Returns the union of lf_emails and emails (separate columns)
20462050
emails = self.get_all_user_emails()
2051+
cla.log.debug(f"{fn}: LG: emails={emails}")
20472052
if len(emails) > 0:
20482053
# remove leading and trailing whitespace before checking emails
20492054
emails = [email.strip() for email in emails]
2055+
cla.log.debug(f"{fn}: LG: emails={emails} (stripped)")
20502056

20512057
# First, we check email whitelist
20522058
whitelist = ccla_signature.get_email_whitelist()

cla-backend/cla/utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,7 @@ def user_signed_project_signature(user: User, project: Project) -> bool:
683683

684684
# Check if we have an CCLA for this user
685685
company_id = user.get_user_company_id()
686+
cla.log.debug(f"{fn}: LG: company_id={company_id}")
686687

687688
ccla_pass = False
688689
if company_id is not None:
@@ -695,6 +696,7 @@ def user_signed_project_signature(user: User, project: Project) -> bool:
695696
employee_signature = user.get_latest_signature(
696697
project.get_project_id(), company_id=company_id, signature_signed=True, signature_approved=True
697698
)
699+
cla.log.debug(f"{fn}: LG: employee_signature={employee_signature}")
698700

699701
if employee_signature is not None:
700702
cla.log.debug(
@@ -712,6 +714,7 @@ def user_signed_project_signature(user: User, project: Project) -> bool:
712714
f"company with id does not exist: {company_id}."
713715
)
714716
return False
717+
cla.log.debug(f"{fn}: LG: company={company}")
715718

716719
# Get CCLA signature of company to access whitelist
717720
cla.log.debug(
@@ -721,6 +724,7 @@ def user_signed_project_signature(user: User, project: Project) -> bool:
721724
signature = company.get_latest_signature(
722725
project.get_project_id(), signature_signed=True, signature_approved=True
723726
)
727+
cla.log.debug(f"{fn}: LG: signature={signature}")
724728

725729
# Don't check the version for employee signatures.
726730
if signature is not None:
@@ -739,6 +743,7 @@ def user_signed_project_signature(user: User, project: Project) -> bool:
739743
# 'project requires ICLA signature as well as CCLA signature ')
740744
if user.is_approved(signature):
741745
ccla_pass = True
746+
cla.log.debug(f"{fn}: LG: ccla_pass={ccla_pass}")
742747
else:
743748
# Set user signatures approved = false due to user failing whitelist checks
744749
cla.log.debug(

0 commit comments

Comments
 (0)