File size: 1,206 Bytes
b4f2238
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""Module for security protocols."""

from typing import Any, Protocol


class ISecurityService(Protocol):
    def encrypt(self, text: str) -> str: ...

    def decrypt(self, encrypted_text: str) -> str: ...

    def mask_sensitive_data(self, data: dict[str, Any], keys: list[Any] | None = None) -> dict[str, Any]: ...

    def encrypt_config(self, config: dict[str, Any]) -> dict[str, Any]: ...

    def decrypt_config(self, config: dict[str, Any]) -> dict[str, Any]: ...


class IValidatorService(Protocol):
    def validate_case_number(self, case_number: str) -> bool: ...

    def normalize_case_number(self, case_number: str) -> str: ...

    def validate_file(self, file_path: str, expected_extensions: list[Any] | None = None) -> dict[str, Any]: ...

    def clean_text(self, text: str) -> str: ...

    def extract_case_numbers(self, text: str) -> list[str]: ...


class IPermissionService(Protocol):
    def can_access_case(self, user_id: int, case_id: int) -> bool: ...

    def can_modify_case(self, user_id: int, case_id: int) -> bool: ...

    def can_access_contract(self, user_id: int, contract_id: int) -> bool: ...

    def has_permission(self, user_id: int, permission: str) -> bool: ...