src.access_control.access_control_port

Port for access control adapters.

 1"""Port for access control adapters."""
 2
 3from abc import ABC, abstractmethod
 4
 5
 6class AccessControlPort(ABC):
 7    """Port: access control interface for checking resource permissions."""
 8
 9    @abstractmethod
10    def may_import(
11        self, bearer_token: str, resource_id: str, resource_type: str, permission: str
12    ) -> bool:
13        """Check whether the caller may perform an action on a resource.
14
15        Args:
16            bearer_token: The caller's bearer token.
17            resource_id: The identifier of the resource being accessed.
18            resource_type: The type of the resource (e.g. "Award").
19            permission: The permission being checked (e.g. "import").
20
21        Returns:
22            True when the action is permitted, False otherwise.
23        """
24        ...
class AccessControlPort(abc.ABC):
 7class AccessControlPort(ABC):
 8    """Port: access control interface for checking resource permissions."""
 9
10    @abstractmethod
11    def may_import(
12        self, bearer_token: str, resource_id: str, resource_type: str, permission: str
13    ) -> bool:
14        """Check whether the caller may perform an action on a resource.
15
16        Args:
17            bearer_token: The caller's bearer token.
18            resource_id: The identifier of the resource being accessed.
19            resource_type: The type of the resource (e.g. "Award").
20            permission: The permission being checked (e.g. "import").
21
22        Returns:
23            True when the action is permitted, False otherwise.
24        """
25        ...

Port: access control interface for checking resource permissions.

@abstractmethod
def may_import( self, bearer_token: str, resource_id: str, resource_type: str, permission: str) -> bool:
10    @abstractmethod
11    def may_import(
12        self, bearer_token: str, resource_id: str, resource_type: str, permission: str
13    ) -> bool:
14        """Check whether the caller may perform an action on a resource.
15
16        Args:
17            bearer_token: The caller's bearer token.
18            resource_id: The identifier of the resource being accessed.
19            resource_type: The type of the resource (e.g. "Award").
20            permission: The permission being checked (e.g. "import").
21
22        Returns:
23            True when the action is permitted, False otherwise.
24        """
25        ...

Check whether the caller may perform an action on a resource.

Args: bearer_token: The caller's bearer token. resource_id: The identifier of the resource being accessed. resource_type: The type of the resource (e.g. "Award"). permission: The permission being checked (e.g. "import").

Returns: True when the action is permitted, False otherwise.