-
Couldn't load subscription status.
- Fork 5
Set Up Casbin RBAC Foundation with DB Table, Model, Policies, and Tests #135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Code Review Completed! 🔥The code review was successfully completed based on your current configurations. Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
backend/app/alembic/versions/fc2d7ddfa265_add_intial_casbin_policies.py
Outdated
Show resolved
Hide resolved
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
1 similar comment
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
Code Review Completed! 🔥The code review was successfully completed based on your current configurations. Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
Code Review Completed! 🔥The code review was successfully completed based on your current configurations. Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
|
Closing this for now as it is not a priority for now, Will come back to it later |
Target issue is #131
This PR lays the foundation for implementing Role-Based Access Control (RBAC) using Casbin. It introduces the core components needed for flexible and scalable permission management across organizations and projects.
Database Table
casbin_ruletable via Alembic migration.p(policy rules)g(org-level role assignments)g2(project-level role assignments)Policy Loader
update_casbin_policiesto load policies from a JSON file.Casbin Integration
rbac_model.confmodel for supporting multi-level RBAC (org and project).Enforcerand adapter initialization.lifespan.Initial Policies
Organization-Level Roles
org_readerproject_readerorg_writerproject_writerorg_adminproject_adminProject-Level Roles
project_readerproject_writerproject_adminTests
test_rbac.py) to validate policy enforcement.Checklist
Before submitting a pull request, please ensure that you mark these task.
fastapi run --reload app/main.pyordocker compose upin the repository root and test.This pull request introduces the foundational setup for Casbin Role-Based Access Control (RBAC) within the
ProjectTech4DevAI/ai-platformrepository. The changes include the addition of a Casbin rule table with appropriate columns and index, as well as initial Casbin policies through an Alembic migration, focusing on RBAC policy updates from a JSON file. A new RBAC model configuration file is introduced, defining roles and matcher logic, although it lacks error handling and documentation. The Casbin RBAC implementation is integrated into the FastAPI app, with lifespan management included. Additionally, theCasbinRulemodel is added for RBAC policy rules, and the import for access control management is updated. The pull request also includes a function to update Casbin policies from a JSON file.