Mybatis Adapter for JCasbin

Load policy from Mybatis or save policy to it

Лицензия

Лицензия

Категории

Категории

MyBatis Данные ORM
Группа

Группа

org.casbin
Идентификатор

Идентификатор

mybatis-adapter
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

Mybatis Adapter for JCasbin
Load policy from Mybatis or save policy to it
Ссылка на сайт

Ссылка на сайт

https://github.com/jcasbin/mybatis-adapter
Система контроля версий

Система контроля версий

https://github.com/jcasbin/mybatis-adapter

Скачать mybatis-adapter

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.casbin/mybatis-adapter/ -->
<dependency>
    <groupId>org.casbin</groupId>
    <artifactId>mybatis-adapter</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.casbin/mybatis-adapter/
implementation 'org.casbin:mybatis-adapter:1.0.0'
// https://jarcasting.com/artifacts/org.casbin/mybatis-adapter/
implementation ("org.casbin:mybatis-adapter:1.0.0")
'org.casbin:mybatis-adapter:jar:1.0.0'
<dependency org="org.casbin" name="mybatis-adapter" rev="1.0.0">
  <artifact name="mybatis-adapter" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.casbin', module='mybatis-adapter', version='1.0.0')
)
libraryDependencies += "org.casbin" % "mybatis-adapter" % "1.0.0"
[org.casbin/mybatis-adapter "1.0.0"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
org.casbin : jcasbin jar 1.1.0
org.mybatis : mybatis jar 3.4.6

test (2)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.11
mysql : mysql-connector-java jar 8.0.16

Модули Проекта

Данный проект не имеет модулей.

mybatis-adapter

codebeat badge Build Status Coverage Status javadoc Maven Central Gitter

Mybatis Adapter is the Mybatis adapter for jCasbin, which provides interfaces for loading policies from Mybatis and saving policies to it.

Installation

<dependency>
    <groupId>org.casbin</groupId>
    <artifactId>mybatis-adapter</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>

Example

package 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

License

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

org.casbin

jCasbin

jCasbin authorization library and the official middlewares

Версии библиотеки

Версия
1.0.0