11"""Authoriser class"""
2+
23import json
34
45from authorisation .api_operation_code import ApiOperationCode
89
910class Authoriser :
1011 """Authoriser class. Used for authorising operations on FHIR vaccinations."""
12+
1113 def __init__ (self ):
1214 self ._cache_client = redis_client
1315
1416 @staticmethod
15- def _expand_permissions (permissions : list [str ]) -> dict [str , list [ApiOperationCode ]]:
17+ def _expand_permissions (
18+ permissions : list [str ],
19+ ) -> dict [str , list [ApiOperationCode ]]:
1620 """Parses and expands permissions data into a dictionary mapping vaccination types to a list of permitted
17- API operations. The raw string from Redis will be in the form VAC.PERMS e.g. COVID19.CRUDS"""
21+ API operations. The raw string from Redis will be in the form VAC.PERMS e.g. COVID19.CRUDS
22+ """
1823 expanded_permissions = {}
1924
2025 for permission in permissions :
@@ -39,7 +44,7 @@ def authorise(
3944 self ,
4045 supplier_system : str ,
4146 requested_operation : ApiOperationCode ,
42- vaccination_types : set [str ]
47+ vaccination_types : set [str ],
4348 ) -> bool :
4449 """Checks that the supplier system is permitted to carry out the requested operation on the given vaccination
4550 type(s)"""
@@ -58,7 +63,7 @@ def filter_permitted_vacc_types(
5863 self ,
5964 supplier_system : str ,
6065 requested_operation : ApiOperationCode ,
61- vaccination_types : set [str ]
66+ vaccination_types : set [str ],
6267 ) -> set [str ]:
6368 """Returns the set of vaccine types that a given supplier can interact with for a given operation type.
6469 This is a more permissive form of authorisation e.g. used in search as it will filter out any requested vacc
0 commit comments