3
3
from http import HTTPStatus
4
4
from typing import Annotated
5
5
6
- from diracx .core .properties import GENERIC_PILOT
7
6
from fastapi import Body , Depends , HTTPException , Query , status
8
7
9
8
from diracx .core .exceptions import (
15
14
PilotFieldsMapping ,
16
15
PilotStatus ,
17
16
)
17
+ from diracx .core .properties import GENERIC_PILOT
18
18
from diracx .logic .pilots .management import (
19
19
add_jobs_to_pilot as add_jobs_to_pilot_bl ,
20
20
)
@@ -68,7 +68,7 @@ async def add_pilot_stamps(
68
68
# TODO: Verify that grid types, sites, destination sites, etc. are valids
69
69
await check_permissions (
70
70
action = ActionType .MANAGE_PILOTS ,
71
- allow_legacy_pilots = True # dirac-admin-add-pilot
71
+ allow_legacy_pilots = True , # dirac-admin-add-pilot
72
72
)
73
73
74
74
# Prevent someone who stole a pilot X509 to create thousands of pilots at a time
@@ -77,7 +77,7 @@ async def add_pilot_stamps(
77
77
if len (pilot_stamps ) != 1 :
78
78
raise HTTPException (
79
79
status_code = status .HTTP_401_UNAUTHORIZED ,
80
- detail = "As a pilot, you can only create yourself."
80
+ detail = "As a pilot, you can only create yourself." ,
81
81
)
82
82
83
83
try :
@@ -205,10 +205,10 @@ async def update_pilot_fields(
205
205
# Ensures stamps validity
206
206
pilot_stamps = [mapping .PilotStamp for mapping in pilot_stamps_to_fields_mapping ]
207
207
await check_permissions (
208
- action = ActionType .MANAGE_PILOTS ,
209
- pilot_db = pilot_db ,
208
+ action = ActionType .MANAGE_PILOTS ,
209
+ pilot_db = pilot_db ,
210
210
pilot_stamps = pilot_stamps ,
211
- allow_legacy_pilots = True # dirac-admin-add-pilot
211
+ allow_legacy_pilots = True , # dirac-admin-add-pilot
212
212
)
213
213
214
214
# Prevent someone who stole a pilot X509 to modify thousands of pilots at a time
@@ -218,10 +218,9 @@ async def update_pilot_fields(
218
218
if len (pilot_stamps ) != 1 :
219
219
raise HTTPException (
220
220
status_code = status .HTTP_401_UNAUTHORIZED ,
221
- detail = "As a pilot, you can only modify yourself."
221
+ detail = "As a pilot, you can only modify yourself." ,
222
222
)
223
223
224
-
225
224
await update_pilots_fields (
226
225
pilot_db = pilot_db ,
227
226
pilot_stamps_to_fields_mapping = pilot_stamps_to_fields_mapping ,
0 commit comments