@@ -10,15 +10,15 @@ def check_team_exists(backend_url, team_id, user_principal_id):
1010 Args:
1111 backend_url: The backend endpoint URL
1212 team_id: The team ID to check
13- user_principal_id: User principal ID for authentication
13+ user_principal_id: User principal ID for authentication (None if no auth)
1414
1515 Returns:
1616 exists: bool
1717 """
1818 check_endpoint = backend_url .rstrip ('/' ) + f'/api/v3/team_configs/{ team_id } '
19- headers = {
20- 'x-ms-client-principal-id' : user_principal_id
21- }
19+ headers = {}
20+ if user_principal_id is not None :
21+ headers [ 'x-ms-client-principal-id' ] = user_principal_id
2222
2323 try :
2424 response = requests .get (check_endpoint , headers = headers )
@@ -39,12 +39,19 @@ def check_team_exists(backend_url, team_id, user_principal_id):
3939
4040backend_url = sys .argv [1 ]
4141directory_path = sys .argv [2 ]
42- user_principal_id = sys .argv [3 ] if len (sys .argv ) > 3 else "00000000-0000-0000-0000-000000000000"
42+ user_principal_id = sys .argv [3 ] if len (sys .argv ) > 3 else None
4343
4444# Convert to absolute path if provided as relative
4545directory_path = os .path .abspath (directory_path )
4646print (f"Scanning directory: { directory_path } " )
4747
48+ # Determine if we should use authentication headers
49+ use_auth_headers = user_principal_id is not None
50+ if use_auth_headers :
51+ print (f"Using authentication with user ID: { user_principal_id } " )
52+ else :
53+ print ("No authentication - backend will use development mode" )
54+
4855files_to_process = [
4956 ("hr.json" , "00000000-0000-0000-0000-000000000001" ),
5057 ("marketing.json" , "00000000-0000-0000-0000-000000000002" ),
@@ -77,9 +84,10 @@ def check_team_exists(backend_url, team_id, user_principal_id):
7784 files = {
7885 'file' : (filename , file_data , 'application/json' )
7986 }
80- headers = {
81- 'x-ms-client-principal-id' : user_principal_id
82- }
87+ headers = {}
88+ if use_auth_headers :
89+ headers ['x-ms-client-principal-id' ] = user_principal_id
90+
8391 params = {
8492 'team_id' : team_id
8593 }
0 commit comments