Skip to content
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

Not able to sync user access policies into the enforcer #2712

Open
sagarve opened this issue Feb 16, 2024 · 7 comments
Open

Not able to sync user access policies into the enforcer #2712

sagarve opened this issue Feb 16, 2024 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@sagarve
Copy link

sagarve commented Feb 16, 2024

Hi,

I have a casdoor running inside a docker container which I'm able to access on localhost:8001 (using casdoor production image, not the all-in-one image). I'm trying to sync my casbin policies from my postgres DB into casdoor, for which I've created an adapter and an enforcer using that adapter. The enforcer successfully loads policies from DB and loaded into the casdoor UI when I sync them for the first time. The issue occurs when I open the enforcer again, it doesn't show the loaded policies and instead show an error message as shown in the screenshot attached (which looks like it's trying to create the same policy rows again). Plz suggest a resolution for this particular issue.

Also wanted to know, if before I call the enforcer API for checking user authorisation for a particular resource, do I need to manually sync the enforcer again in case any new policies were added into the DB? Or does it refer to the configured postgres DB directly to query user permissions?

image
@casbin-bot
Copy link
Contributor

@casbin-bot casbin-bot added the enhancement New feature or request label Feb 16, 2024
@sagarve
Copy link
Author

sagarve commented Feb 20, 2024

Any update on this?

@sagarve
Copy link
Author

sagarve commented Feb 21, 2024

@hsluoyz Can you help resolving this issues?
Also, it would be really helpful if you could help clarify this question
"Also wanted to know, if before I call the enforcer API for checking user authorisation for a particular resource, do I need to manually sync the enforcer again in case any new policies were added into the DB? Or does it refer to the configured postgres DB directly to query user permissions?"

@hsluoyz
Copy link
Member

hsluoyz commented Feb 21, 2024

@hsluoyz what posgres version did you use? Did you try MySQL too? What are the reproduce steps?

@sagarve
Copy link
Author

sagarve commented Feb 21, 2024

I used Postgres 15. No I didn't try MySQL.
Reproduce steps:

  1. Create an adapter. Test that DB connection is successful
  2. Create an enforcer using that adapter and sync policies (Policies show up)
  3. Save and Exit
  4. Opening that enforcer again shows this error message.

@hsluoyz hsluoyz added bug Something isn't working and removed enhancement New feature or request labels Feb 21, 2024
@dacongda
Copy link
Contributor

dacongda commented Feb 24, 2024

@sagarve I can't reproduce this problem in the newest version, can you record a video to display?

I use pgsql 16 to reproduce.

@dacongda
Copy link
Contributor

@hsluoyz Can you help resolving this issues? Also, it would be really helpful if you could help clarify this question "Also wanted to know, if before I call the enforcer API for checking user authorisation for a particular resource, do I need to manually sync the enforcer again in case any new policies were added into the DB? Or does it refer to the configured postgres DB directly to query user permissions?"

it refer to the configured postgres DB directly to query user permissions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants