Git Product home page Git Product logo

Comments (7)

hsluoyz avatar hsluoyz commented on June 17, 2024

Can you be more specific?

from typeorm-adapter.

nodece avatar nodece commented on June 17, 2024

@GopherJ We should use typeorm to synchronize casbin_rule.
If typeorm-adapter cannot meet your needs, you can create own adapter.

from typeorm-adapter.

GopherJ avatar GopherJ commented on June 17, 2024

hello @hsluoyz @nodece , sure it meets my needs, I was wondering if it overwrites casbin_rule even it exists already, because I added some CONTRAINT to this table to meet my needs.

Also my issue is that I have a casbin server with some management apis, I use postgresql for storing these policies, yesterday I was trying to add a new function to load policy.csv into postgresql while starting or restarting, using this way I can have some default policies, but if I restart this server or run multiple times the server, it duplicates my default policies...

Here the code to load one row of csv into postgresql:

 enforcer.addPolicy(addPrefix(role), domain, object, action).catch(console.error);

So I tried to create casbin_rule manually using rust diesel, and I added some constraints to casbin_rule table, but it seems that it doesn't help, so I think it's typeorm-adapter overited my own casbin_rule table.

// rbac with domain
CONSTRAINT unique_key UNIQUE(ptype, v0, v1, v2, v3)

from typeorm-adapter.

nodece avatar nodece commented on June 17, 2024

@GopherJ
My Solution:
Please check manually whether the table exists then set synchronize in typeorm option.

from typeorm-adapter.

GopherJ avatar GopherJ commented on June 17, 2024

@nodece my setup script will garantee that this table exists (it will be created by diesel), so I need to set synchronize: false right?

from typeorm-adapter.

nodece avatar nodece commented on June 17, 2024

@GopherJ Right!

from typeorm-adapter.

GopherJ avatar GopherJ commented on June 17, 2024

@nodece thanks!

from typeorm-adapter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.