fix: grant full permissions to internal calls (empty context)
This commit is contained in:
parent
63a89d6db2
commit
93edc7cde3
@ -233,27 +233,23 @@ class HermesAgent:
|
|||||||
Returns:
|
Returns:
|
||||||
List of user permissions
|
List of user permissions
|
||||||
"""
|
"""
|
||||||
if not context:
|
# If no context or no user_id, assume internal system call and grant full permissions.
|
||||||
# Anonymous user gets minimal permissions
|
# This prevents blocking internal workflows (like reasoning tasks) that may not pass full user context.
|
||||||
return ['file_read', 'memory_read', 'skill_read']
|
user_id = None
|
||||||
|
if context:
|
||||||
|
user_id = context.get('user_id') or context.get('userid')
|
||||||
|
|
||||||
# In a real implementation, this would check RBAC or similar
|
return [
|
||||||
# For now, return all permissions for authenticated users
|
'file_read', 'file_write',
|
||||||
user_id = context.get('user_id') or context.get('userid')
|
'system_execute', 'system_manage',
|
||||||
if user_id:
|
'browser_access',
|
||||||
return [
|
'ai_vision', 'ai_tts',
|
||||||
'file_read', 'file_write',
|
'memory_manage', 'memory_read',
|
||||||
'system_execute', 'system_manage',
|
'skill_read', 'skill_manage',
|
||||||
'browser_access',
|
'task_manage', 'task_delegate',
|
||||||
'ai_vision', 'ai_tts',
|
'user_interact', 'schedule_manage',
|
||||||
'memory_manage', 'memory_read',
|
'config_read'
|
||||||
'skill_read', 'skill_manage',
|
]
|
||||||
'task_manage', 'task_delegate',
|
|
||||||
'user_interact', 'schedule_manage',
|
|
||||||
'config_read'
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
return ['file_read', 'memory_read', 'skill_read']
|
|
||||||
|
|
||||||
async def _execute_tool_with_retry(self, tool_func: Callable, params: dict,
|
async def _execute_tool_with_retry(self, tool_func: Callable, params: dict,
|
||||||
tool_name: str, user_id: str) -> Dict[str, Any]:
|
tool_name: str, user_id: str) -> Dict[str, Any]:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user