Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jcasbin/mybatis-adapter
MyBatis 3 adapter for Casbin
https://github.com/jcasbin/mybatis-adapter
access-control adapter authorization casbin java jcasbin jdbc mybatis storage-driver
Last synced: about 2 months ago
JSON representation
MyBatis 3 adapter for Casbin
- Host: GitHub
- URL: https://github.com/jcasbin/mybatis-adapter
- Owner: jcasbin
- License: apache-2.0
- Created: 2020-03-19T08:13:32.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-06T14:57:05.000Z (over 1 year ago)
- Last Synced: 2023-07-06T15:44:08.307Z (over 1 year ago)
- Topics: access-control, adapter, authorization, casbin, java, jcasbin, jdbc, mybatis, storage-driver
- Language: Java
- Homepage: https://github.com/casbin/jcasbin
- Size: 24.4 KB
- Stars: 8
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mybatis-adapter
[![codebeat badge](https://codebeat.co/badges/998c8e12-ffdd-4196-b2a2-8979d7f1ee8a)](https://codebeat.co/projects/github-com-jcasbin-mybatis-adapter-master)
[![build](https://github.com/jcasbin/mybatis-adapter/actions/workflows/ci.yml/badge.svg)](https://github.com/jcasbin/mybatis-adapter/actions)
[![codecov](https://codecov.io/github/jcasbin/mybatis-adapter/branch/master/graph/badge.svg?token=4YRFEQY7VK)](https://codecov.io/github/jcasbin/mybatis-adapter)
[![javadoc](https://javadoc.io/badge2/org.casbin/mybatis-adapter/javadoc.svg)](https://javadoc.io/doc/org.casbin/mybatis-adapter)
[![Maven Central](https://img.shields.io/maven-central/v/org.casbin/mybatis-adapter.svg)](https://mvnrepository.com/artifact/org.casbin/mybatis-adapter/latest)
[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord&label=discord&color=5865F2)](https://discord.gg/S5UjpzGZjN)Mybatis Adapter is the Mybatis adapter for jCasbin, which provides interfaces for loading policies from Mybatis and saving policies to it.
## Installation
org.casbin
mybatis-adapter
version
## Examplepackage com.company.example;
import org.casbin.jcasbin.main.Enforcer;
import org.casbin.jcasbin.util.Util;
import org.casbin.adapter.MybatisAdapter;
public class Example {
public void test() {
Enforcer e = new Enforcer("examples/rbac_model.conf", "examples/rbac_policy.csv");
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/tbl";
String username = "YourUsername";
String password = "YourPassword";
MybatisAdapter a = new MybatisAdapter(driver, url, username, password, true);
// Save policy to DB
a.savePolicy(e.getModel());
// Load policy from DB
a.loadPolicy(e.getModel());
}
}
## Getting Help- [jCasbin](https://github.com/casbin/jcasbin)
## License
This project is under Apache 2.0 License. See the [LICENSE](LICENSE) file for the full license text.