{"id":21252628,"url":"https://github.com/jcasbin/mybatis-adapter","last_synced_at":"2025-07-11T01:33:00.651Z","repository":{"id":37367704,"uuid":"248446110","full_name":"jcasbin/mybatis-adapter","owner":"jcasbin","description":"MyBatis 3 adapter for Casbin","archived":false,"fork":false,"pushed_at":"2023-07-06T14:57:05.000Z","size":25,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-07-06T15:44:08.307Z","etag":null,"topics":["access-control","adapter","authorization","casbin","java","jcasbin","jdbc","mybatis","storage-driver"],"latest_commit_sha":null,"homepage":"https://github.com/casbin/jcasbin","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jcasbin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-19T08:13:32.000Z","updated_at":"2022-10-21T07:06:25.000Z","dependencies_parsed_at":"2022-08-18T19:31:59.586Z","dependency_job_id":null,"html_url":"https://github.com/jcasbin/mybatis-adapter","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcasbin%2Fmybatis-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcasbin%2Fmybatis-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcasbin%2Fmybatis-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcasbin%2Fmybatis-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcasbin","download_url":"https://codeload.github.com/jcasbin/mybatis-adapter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225669664,"owners_count":17505386,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["access-control","adapter","authorization","casbin","java","jcasbin","jdbc","mybatis","storage-driver"],"created_at":"2024-11-21T03:48:11.019Z","updated_at":"2024-11-21T03:48:11.675Z","avatar_url":"https://github.com/jcasbin.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mybatis-adapter\n\n[![codebeat badge](https://codebeat.co/badges/998c8e12-ffdd-4196-b2a2-8979d7f1ee8a)](https://codebeat.co/projects/github-com-jcasbin-mybatis-adapter-master)\n[![build](https://github.com/jcasbin/mybatis-adapter/actions/workflows/ci.yml/badge.svg)](https://github.com/jcasbin/mybatis-adapter/actions)\n[![codecov](https://codecov.io/github/jcasbin/mybatis-adapter/branch/master/graph/badge.svg?token=4YRFEQY7VK)](https://codecov.io/github/jcasbin/mybatis-adapter)\n[![javadoc](https://javadoc.io/badge2/org.casbin/mybatis-adapter/javadoc.svg)](https://javadoc.io/doc/org.casbin/mybatis-adapter)\n[![Maven Central](https://img.shields.io/maven-central/v/org.casbin/mybatis-adapter.svg)](https://mvnrepository.com/artifact/org.casbin/mybatis-adapter/latest)\n[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord\u0026label=discord\u0026color=5865F2)](https://discord.gg/S5UjpzGZjN)\n\nMybatis Adapter is the Mybatis adapter for jCasbin, which provides interfaces for loading policies from Mybatis and saving policies to it.\n\n## Installation\n\n    \u003cdependency\u003e\n        \u003cgroupId\u003eorg.casbin\u003c/groupId\u003e\n        \u003cartifactId\u003emybatis-adapter\u003c/artifactId\u003e\n        \u003cversion\u003eversion\u003c/version\u003e\n    \u003c/dependency\u003e\n    \n## Example\n\n    package com.company.example;\n    \n    import org.casbin.jcasbin.main.Enforcer;\n    import org.casbin.jcasbin.util.Util;\n    import org.casbin.adapter.MybatisAdapter;\n    \n    public class Example {\n        public void test() {\n            Enforcer e = new Enforcer(\"examples/rbac_model.conf\", \"examples/rbac_policy.csv\");\n        \n            String driver = \"com.mysql.jdbc.Driver\";\n            String url = \"jdbc:mysql://localhost:3306/tbl\";\n            String username = \"YourUsername\";\n            String password = \"YourPassword\";\n            \n            MybatisAdapter a = new MybatisAdapter(driver, url, username, password, true);\n        \n            // Save policy to DB\n            a.savePolicy(e.getModel());\n        \n            // Load policy from DB\n            a.loadPolicy(e.getModel());\n        }\n    }\n    \n## Getting Help\n\n- [jCasbin](https://github.com/casbin/jcasbin)\n\n## License\n\nThis project is under Apache 2.0 License. See the [LICENSE](LICENSE) file for the full license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcasbin%2Fmybatis-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcasbin%2Fmybatis-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcasbin%2Fmybatis-adapter/lists"}