vintasoftware / django-ai-assistant

Integrate AI Assistants with Django to build intelligent applications
https://vintasoftware.github.io/django-ai-assistant/
MIT License
61 stars 6 forks source link

Permissions #6

Open fjsj opened 1 month ago

fjsj commented 1 month ago

We need a granular way to support permissioning, better than the current "callback" settings approach (like AI_ASSISTANT_CAN_CREATE_THREAD_FN).

Check how popular Django apps implement permission callbacks. Maybe they use something different than function paths at settings?

Perhaps a simpler approach for us is a single class to receive a user and check permissions for it on each method, a PermissionChecker class.

Edit: Check how Chainlit does it as well: https://docs.chainlit.io/authentication/overview

joaopedroalbq commented 3 days ago

Another suggestion: Django Ninja Extra. It is an extension for django ninja and it has permission classes. The required changes would be:

The permission classes can be applied to the controller (all endpoints) or for each endpoint.

fjsj commented 3 days ago

thanks @joaopedroalbq, that seems good too