Coder Social home page Coder Social logo

arangodb-adapter's Introduction

ArangoDB Adapter

GoDoc Go Report Card Build Status

ArangoDB Adapter is the Arango DB adapter for Casbin.

TODO

  • Adapter cleanup (closing connections). See this issue.
  • Remove hardcoded db & collection names.
  • Indexes.
  • Filtered policies.
  • Policy removal.
  • Add partial policy removal.
  • Unit tests.
  • Better README (examples of use).

Example

Following snippet of code shows how to initialize adapter and use with casbin enforcer. See documentation for list of all available options.

a, err := arango.NewAdapter(
    arango.OpCollectionName("casbinrules"),
    arango.OpFieldMapping("p", "sub", "obj", "act"))
if err != nil {
    ...
}

e, err := casbin.NewEnforcer("model.conf", a)

...

Contributing

Documentation

Currently this README and examples folder are best source of documentation for this project and of course - source code itself.

Reporting issues

Raise an issue for bugs, enhancements and general discussions/questions about adapter.

Running tests

It would make very little sense to perform an isolated unit tests for code like that. Therefore tests connects to real database instance. To test fully all options two instances must be run: with and without authorization. CI setup may be helpful to establish working testing rig:

docker run -e ARANGO_NO_AUTH=1 -p 127.0.0.1:8529:8529 -d --name arangodb-instance-no-auth arangodb:3.7.2
docker run -e ARANGO_ROOT_PASSWORD=password -p 127.0.0.1:8530:8529 -d --name arangodb-instance-auth arangodb:3.7.2

Then, running tests is as simple as:

go test .
ok  	github.com/adamwasila/arangodb-adapter	0.847s

Pull requests

If possible each PR should be linked to some issue (except trivial ones like typo fixes). Avoid unrelated changes. Redundant commits should be squashed together before merge.

Getting Help

  • Casbin - main library this adapter is extending

License

This project is under Apache 2.0 License. See the LICENSE file for the full license text.

arangodb-adapter's People

Contributors

adamwasila avatar ajayguls avatar

Stargazers

Nadeem Hassan avatar

Watchers

James Cloos avatar

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.