fix: fix broken links (#5)

1 file changed
tree: 79d3b10abcc1aab62d33200b6665ce3a3347e1ff
  1. .github/
  2. 4DaysORM/
  3. tests/
  4. .gitignore
  5. casbin-orm-adapter-1.0.0-1.rockspec
  6. CasbinAdapter.lua
  7. LICENSE
  8. README.md
README.md

4daysorm-adapter

GitHub Action Coverage Status Discord

casbin-orm-adapter is a 4DaysORM based adapter for Casbin that supports policies from MySQL and SQLite3 databases.

Installation

First, install the corresponding driver of LuaSQL from LuaRocks based on the database you use:

  • For MySQL, install luasql-mysql.
  • For SQLite3, install luasql-sqlite3.

Then install the casbin-orm-adapter from LuaRocks by:

sudo luarocks install https://raw.githubusercontent.com/casbin-lua/4daysorm-adapter/master/casbin-orm-adapter-1.0.0-1.rockspec

Usage

To create a new Casbin Enforcer using the adapter, you need to create a global variable DB containing the database configuration details (more details here):

DB = {
    type = "mysql", -- or "sqlite3"
    name = "your_database_name",
    username = "your_username",
    password = "your_password",
    new = true
}

local Enforcer = require("casbin")
local Adapter = require("CasbinAdapter")

local a = Adapter:new() -- uses the global DB configuration
local e = Enforcer:new("/path/to/model.conf", a) -- creates a new Casbin enforcer with the model.conf file and the database

Getting Help

License

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