How to achieve transaction consistency between Casbin policy operations and other database operations?
@hsluoyz is already working on this.
Since Aug 6, 2026.
Assessment
This issue has not been assessed yet.
Description
Description
In our application, we need to update both business data and Casbin authorization policies atomically. For example, when changing a user's role:
Update the user's role in the business database
Update the corresponding Casbin grouping policy
Currently, these operations happen in separate transactions, risking data inconsistency if one succeeds and the other fails.
Questions:
What are the recommended patterns for ensuring transaction consistency between Casbin policies and business data?
Does Casbin provide built-in support for coordinating these operations within a single transaction?
Are there adapter-specific solutions (e.g., for Gorm, Xorm, or specific databases)?
Context:
We're using gorm-adapter
Database: PostgreSQL
Application framework: [specify framework, e.g., Go Gin, Spring Boot]
Any guidance or examples would be greatly appreciated!
- Dominant language
- Go
- Stars
- 20.4k
- Forks
- 1.8k
- Avg merge
- 5d 11h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/casbin
-
enhancement
-
enhancement
-
enhancement
-
enhancement
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·