@@ -81,7 +81,8 @@ def get_logger(self):
8181
8282 def __authorize_request (self , * , id_token : str , action_id : ActionId ,
8383 resource : BaseSliver or ExperimentTopology = None ,
84- lease_end_time : datetime = None ) -> FabricToken :
84+ lease_end_time : datetime = None ,
85+ poa_operation : str = None ) -> FabricToken :
8586 """
8687 Authorize request
8788 :param id_token:
@@ -96,6 +97,11 @@ def __authorize_request(self, *, id_token: str, action_id: ActionId,
9697
9798 if fabric_token .subject is None :
9899 raise OrchestratorException (http_error_code = UNAUTHORIZED , message = "Invalid token" )
100+ project_uuid , tags , project_name = fabric_token .first_project
101+ if action_id == ActionId .POA and poa_operation and poa_operation == "rescan" and project_uuid and \
102+ tags and "Component.FPGA" not in tags :
103+ raise OrchestratorException (http_error_code = UNAUTHORIZED ,
104+ message = "POA rescan not authorized - missing permissions Component.FPGA" )
99105 return fabric_token
100106
101107 def get_broker (self , * , controller : ABCMgmtControllerMixin ) -> ID :
@@ -923,7 +929,8 @@ def poa(self, *, token: str, sliver_id: str, poa: PoaAvro) -> tuple[str, str]:
923929
924930 rid = ID (uid = sliver_id ) if sliver_id is not None else None
925931
926- fabric_token = self .__authorize_request (id_token = token , action_id = ActionId .POA )
932+ fabric_token = self .__authorize_request (id_token = token , action_id = ActionId .POA ,
933+ poa_operation = poa .operation )
927934 user_id = fabric_token .uuid
928935 project , tags , project_name = fabric_token .first_project
929936
0 commit comments