Saving these changes in a working state. Just in case.
This commit is contained in:
@@ -46,6 +46,10 @@ logger = get_logger(__name__)
|
||||
class AccountContext(BaseModel):
|
||||
account_id: Optional[int]
|
||||
account_id_random: Optional[str]
|
||||
administrator: bool = False
|
||||
manager: bool = False
|
||||
super: bool = False
|
||||
auth_method: str = 'legacy_header'
|
||||
|
||||
|
||||
# --- Dependency Function for Account Context ---
|
||||
@@ -96,6 +100,18 @@ def get_account_context(
|
||||
return AccountContext(account_id=resolved_account_id, account_id_random=resolved_account_id_random)
|
||||
|
||||
|
||||
# --- Optional version to avoid breaking api_crud_v3 imports if they use it ---
|
||||
def get_account_context_optional(
|
||||
x_account_id: Optional[str] = Header(None, min_length=11, max_length=22),
|
||||
x_no_account_id: Optional[str] = Header(None, min_length=3, max_length=100),
|
||||
x_no_account_id_token: Optional[str] = Query(None, min_length=11, max_length=22),
|
||||
) -> AccountContext:
|
||||
try:
|
||||
return get_account_context(x_account_id, x_no_account_id, x_no_account_id_token)
|
||||
except HTTPException:
|
||||
return AccountContext(account_id=None, account_id_random=None, auth_method='guest')
|
||||
|
||||
|
||||
# --- Pydantic Model for Pagination ---
|
||||
class PaginationParams(BaseModel):
|
||||
limit: int = 100 # Default limit
|
||||
|
||||
Reference in New Issue
Block a user