|
|
@@ -12,7 +12,7 @@ GITHUB_CLIENT_SECRET = os.getenv('GITHUB_CLIENT_SECRET', '').strip()
|
|
|
|
|
|
class UserVerifier:
|
|
|
def __init__(self) -> None:
|
|
|
- logger.info('Initializing UserVerifier')
|
|
|
+ logger.debug('Initializing UserVerifier')
|
|
|
self.file_users: list[str] | None = None
|
|
|
self.sheets_client: GoogleSheetsClient | None = None
|
|
|
self.spreadsheet_id: str | None = None
|
|
|
@@ -25,7 +25,7 @@ class UserVerifier:
|
|
|
"""Load users from text file if configured"""
|
|
|
waitlist = os.getenv('GITHUB_USER_LIST_FILE')
|
|
|
if not waitlist:
|
|
|
- logger.info('GITHUB_USER_LIST_FILE not configured')
|
|
|
+ logger.debug('GITHUB_USER_LIST_FILE not configured')
|
|
|
return
|
|
|
|
|
|
if not os.path.exists(waitlist):
|
|
|
@@ -46,10 +46,10 @@ class UserVerifier:
|
|
|
sheet_id = os.getenv('GITHUB_USERS_SHEET_ID')
|
|
|
|
|
|
if not sheet_id:
|
|
|
- logger.info('GITHUB_USERS_SHEET_ID not configured')
|
|
|
+ logger.debug('GITHUB_USERS_SHEET_ID not configured')
|
|
|
return
|
|
|
|
|
|
- logger.info('Initializing Google Sheets integration')
|
|
|
+ logger.debug('Initializing Google Sheets integration')
|
|
|
self.sheets_client = GoogleSheetsClient()
|
|
|
self.spreadsheet_id = sheet_id
|
|
|
|
|
|
@@ -61,21 +61,21 @@ class UserVerifier:
|
|
|
if not self.is_active():
|
|
|
return True
|
|
|
|
|
|
- logger.info(f'Checking if GitHub user {username} is allowed')
|
|
|
+ logger.debug(f'Checking if GitHub user {username} is allowed')
|
|
|
if self.file_users:
|
|
|
if username in self.file_users:
|
|
|
- logger.info(f'User {username} found in text file allowlist')
|
|
|
+ logger.debug(f'User {username} found in text file allowlist')
|
|
|
return True
|
|
|
logger.debug(f'User {username} not found in text file allowlist')
|
|
|
|
|
|
if self.sheets_client and self.spreadsheet_id:
|
|
|
sheet_users = self.sheets_client.get_usernames(self.spreadsheet_id)
|
|
|
if username in sheet_users:
|
|
|
- logger.info(f'User {username} found in Google Sheets allowlist')
|
|
|
+ logger.debug(f'User {username} found in Google Sheets allowlist')
|
|
|
return True
|
|
|
logger.debug(f'User {username} not found in Google Sheets allowlist')
|
|
|
|
|
|
- logger.info(f'User {username} not found in any allowlist')
|
|
|
+ logger.debug(f'User {username} not found in any allowlist')
|
|
|
return False
|
|
|
|
|
|
|
|
|
@@ -83,10 +83,10 @@ async def authenticate_github_user(auth_token) -> bool:
|
|
|
user_verifier = UserVerifier()
|
|
|
|
|
|
if not user_verifier.is_active():
|
|
|
- logger.info('No user verification sources configured - allowing all users')
|
|
|
+ logger.debug('No user verification sources configured - allowing all users')
|
|
|
return True
|
|
|
|
|
|
- logger.info('Checking GitHub token')
|
|
|
+ logger.debug('Checking GitHub token')
|
|
|
|
|
|
if not auth_token:
|
|
|
logger.warning('No GitHub token provided')
|
|
|
@@ -112,7 +112,7 @@ async def get_github_user(token: str) -> str:
|
|
|
Returns:
|
|
|
github handle of the user
|
|
|
"""
|
|
|
- logger.info('Fetching GitHub user info from token')
|
|
|
+ logger.debug('Fetching GitHub user info from token')
|
|
|
headers = {
|
|
|
'Accept': 'application/vnd.github+json',
|
|
|
'Authorization': f'Bearer {token}',
|