gateway/modules/features/chatBot/utils/permissions.py
2025-10-03 13:17:45 +02:00

60 lines
1.8 KiB
Python

"""Mock permissions module for chatbot access control.
This module provides mock permission functions that will be replaced
with actual database-driven permissions in the future.
"""
from datetime import datetime
from modules.features.chatBot.utils.toolRegistry import get_registry
# TODO: Replace these mock implementations with actual database queries
def get_allowed_tools(*, user_id: str) -> list[str]:
"""Get list of tool IDs that a user is allowed to use.
This is a mock implementation that returns all available tools
regardless of user_id. In production, this will query the database
for user-specific permissions.
Args:
user_id: The unique identifier of the user
Returns:
List of tool IDs (e.g., ["shared.tavily_search", "customer.query_althaus_database"])
"""
registry = get_registry()
return registry.list_tool_ids()
def get_allowed_models(*, user_id: str) -> list[str]:
"""Get list of AI models that a user is allowed to use.
This is a mock implementation that returns a fixed list of models.
In production, this will query the database for user-specific model permissions.
Args:
user_id: The unique identifier of the user
Returns:
List of model identifiers (e.g., ["gpt-5", "claude-4-5"])
"""
return ["gpt-5", "claude-4-5"]
def get_system_prompt(*, user_id: str) -> str:
"""Get the system prompt for a user's chatbot session.
This is a mock implementation that returns a generic prompt with today's date.
In production, this will query the database for user-specific or role-specific prompts.
Args:
user_id: The unique identifier of the user
Returns:
The system prompt string with the current date
"""
current_date = datetime.now().strftime("%Y-%m-%d")
return f"You're a smart assistant. Today is {current_date}"