Skip to content

Commit

Permalink
fix: docs
Browse files Browse the repository at this point in the history
  • Loading branch information
trbtm committed Jul 9, 2024
1 parent 241ac5c commit c053715
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ from casbin.persist.adapters import FileAdapter

casbin_enforcer = CasbinEnforcer(app, adapter)
watcher = PostgresqlWatcher(host=HOST, port=PORT, user=USER, password=PASSWORD, dbname=DBNAME)
watcher.set_update_callback(casbin_enforcer.adapter.load_policy)
watcher.set_update_callback(casbin_enforcer.load_policy)
casbin_enforcer.set_watcher(watcher)

# Call should_reload before every call of enforce to make sure
Expand Down Expand Up @@ -54,7 +54,7 @@ casbin_enforcer.set_watcher(watcher)
# Call should_reload before every call of enforce to make sure
# the policy is update to date
if watcher.should_reload():
adapter.load_policy()
casbin_enforcer.load_policy()

if casbin_enforcer.enforce("alice", "data1", "read"):
# permit alice to read data1
Expand Down

0 comments on commit c053715

Please sign in to comment.