@@ -118,6 +118,38 @@ def get_user(client, user_guid):
118118 error_message = format_error_message (e )
119119 raise RuntimeError (f"Error getting user: { error_message } " )
120120
121+ def get_current_user_full_name (client ):
122+ """
123+ Get the full name of the current user from the Connect API
124+
125+ Args:
126+ client: The Connect client instance
127+
128+ Returns:
129+ str: The full name of the current user or "Unknown" if not available
130+ """
131+ try :
132+ # Get the current user information
133+ current_user = client .me
134+
135+ # Extract first and last name
136+ first_name = current_user .get ("first_name" , "" )
137+ last_name = current_user .get ("last_name" , "" )
138+
139+ # Combine into full name
140+ full_name = f"{ first_name } { last_name } " .strip ()
141+
142+ # Return username if full name is empty
143+ if not full_name :
144+ return current_user .get ("username" , "Unknown" )
145+
146+ return full_name
147+ except Exception as e :
148+ # Handle any errors gracefully
149+ error_message = format_error_message (e )
150+ print (f"Warning: Could not retrieve current user: { error_message } " )
151+ return "Unknown"
152+
121153# Function to validate content health (simple HTTP 200 check)
122154def validate (client , guid , connect_server , api_key ):
123155 # Get content details
@@ -313,7 +345,7 @@ def create_instructions_box(instructions_html_content):
313345 """
314346
315347# Function to create the report display for a result
316- def create_report_display (result_data , check_time_value ):
348+ def create_report_display (result_data , check_time_value , current_user_name ):
317349 if result_data is None :
318350 return None
319351
@@ -338,15 +370,12 @@ def create_report_display(result_data, check_time_value):
338370 status_colors = CSS_COLORS ["fail" ]
339371 status_icon = "❌" # X mark
340372
341- # Get HTTP Code
342- http_code = result_data .get ('http_code' , '' )
343-
344373 # Format logs link if available
345374 logs_url = result_data .get ('logs_url' , '' )
346375 if logs_url :
347376 logs_display = f"<a href='{ logs_url } ' target='_blank' style='text-decoration:none;'>📋 View Logs</a>"
348377 else :
349- logs_display = "No logs available — only visible to the content owner and collaborators."
378+ logs_display = f"Log access is restricted for { current_user_name } . Logs are only available to the content owner and collaborators."
350379
351380 # Format owner information
352381 owner_name = result_data .get ('owner_name' , 'Unknown' )
0 commit comments