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

Order of policies stored in DB after a.savePolicy is not same as source #56

Open
azmi-plavaga opened this issue Jan 18, 2024 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@azmi-plavaga
Copy link

Order of policies in DB after savePolicy is not same as in source file: examples/rbac_policy.csv

Sample test: https://github.com/node-casbin/prisma-adapter/blob/master/test/adapter.test.ts
Code snippet: line 40-50

 try {
      // Because the DB is empty at first,
      // so we need to load the policy from the file adapter (.CSV) first.
      let e = await newEnforcer(
        'examples/rbac_model.conf',
        'examples/rbac_policy.csv'
      );

      // This is a trick to save the current policy to the DB.
      // We can't call e.savePolicy() because the adapter in the enforcer is still the file adapter.
      // The current policy means the policy in the Node-Casbin enforcer (aka in memory).
      await a.savePolicy(e.getModel());
@casbin-bot
Copy link

@nodece @Shivansh-yadav13

@casbin-bot casbin-bot added the question Further information is requested label Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants