Closed gerbyzation closed 3 years ago
@techoner I don't think we even have complete Watcher support in pyCasbin? See: https://github.com/casbin/pycasbin/search?q=watcher&unscoped_q=watcher
We even didn't define the Watcher interface yet. Then we need to implement PostgreSQL watcher.
Can anyone work on this?
@hsluoyz there is one watcher implementation for python listed on the website though? https://github.com/ScienceLogic/flask-casbin-redis-watcher
Python probably doesn't have an explicit interface, a set_watcher
has been implemented
https://github.com/casbin/pycasbin/blob/a915dce5d7d0707f98a91c3677ef47a8d6ce6cd2/casbin/core_enforcer.py#L117
and watcher.update()
is called by the enforcer: https://github.com/casbin/pycasbin/blob/0759a6a754ffc432596ca2286da42dcf7b56e6b0/casbin/internal_enforcer.py
@gerbyzation Yes. I forgot Python doesn't need to define class. Then we only need to implement PostgreSQL watcher.
@DivyPatel9881 @kingiw @hackerchai Can anyone work on this?
@gerbyzation repo created: https://github.com/pycasbin/postgresql-watcher
Can you make a PR to contribute code?
I want to try to do it. I should be able to submit pr by the end of the week @hsluoyz
I have submitted the draft, may I ask who can review it #1 PR init
New issue on request, not 100% sure if it should be under this repo or elsewhere but as I'd want it to be compatible with django here we go.
I'm exploring the idea of building a watcher compatible with this adapter that uses postgres' built in listen/notify functionality, as that would avoid the need for an additional system dependency such as redis or etcd. Any thoughts on this?