casbin / xorm-adapter

Xorm adapter for Casbin
https://github.com/casbin/casbin
Apache License 2.0
384 stars 58 forks source link

Primary key support? #6

Closed eahrend closed 6 years ago

eahrend commented 6 years ago

Hey,

So I wanted to add a column to my casbin table, specifically a primary key so I can identify rules if I do SQL queries by ID for ease of identification. Is that possible, I know currently there is no support for it but is there a reason for this?

hsluoyz commented 6 years ago

I don't think adding ID to policy rules is a necessity. In Casbin, policy rules only have order under certain conditions (for priority model). There is no way to identify one rule. But you can add customized support for this adapter.

eahrend commented 6 years ago

Yeah, I created a fork to support the database I'm using. The idea is to take the casbin rule, give them an ID which is assigned to a table with a human readable name in a separate table.

hsluoyz commented 6 years ago

So you want to merge the change to this repo? I don't know if it affects other users due to the add of this ID. Do you have any suggestion for a better way to solve it?

hsluoyz commented 6 years ago

Closed as stale.