{"id":21158155,"url":"https://github.com/node-casbin/sequelize-adapter","last_synced_at":"2025-04-06T09:06:42.401Z","repository":{"id":32895789,"uuid":"145073170","full_name":"node-casbin/sequelize-adapter","owner":"node-casbin","description":"Sequelize adapter for Casbin","archived":false,"fork":false,"pushed_at":"2023-12-09T08:22:28.000Z","size":1426,"stargazers_count":64,"open_issues_count":0,"forks_count":34,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-30T08:11:32.348Z","etag":null,"topics":["abac","access-control","acl","adapter","auth","authorization","authz","casbin","node-casbin","orm","rbac","sequelize"],"latest_commit_sha":null,"homepage":"https://github.com/casbin/node-casbin","language":"TypeScript","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/node-casbin.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-17T04:52:02.000Z","updated_at":"2024-08-24T15:03:42.000Z","dependencies_parsed_at":"2024-06-18T16:54:07.156Z","dependency_job_id":"0a1b2b9f-6203-4b0c-9196-b273ceb0ffd1","html_url":"https://github.com/node-casbin/sequelize-adapter","commit_stats":{"total_commits":67,"total_committers":20,"mean_commits":3.35,"dds":0.582089552238806,"last_synced_commit":"55287df3b1d0cc20f62d05cad39e451919a6303b"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-casbin%2Fsequelize-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-casbin%2Fsequelize-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-casbin%2Fsequelize-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-casbin%2Fsequelize-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/node-casbin","download_url":"https://codeload.github.com/node-casbin/sequelize-adapter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247457799,"owners_count":20941906,"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":["abac","access-control","acl","adapter","auth","authorization","authz","casbin","node-casbin","orm","rbac","sequelize"],"created_at":"2024-11-20T12:16:21.681Z","updated_at":"2025-04-06T09:06:42.382Z","avatar_url":"https://github.com/node-casbin.png","language":"TypeScript","readme":"# Sequelize Adapter\n\n[![NPM version][npm-image]][npm-url]\n[![NPM download][download-image]][download-url]\n[![codebeat badge](https://codebeat.co/badges/c17c9ee1-da42-4db3-8047-9574ad2b23b1)](https://codebeat.co/projects/github-com-node-casbin-sequelize-adapter-master)\n[![ci](https://github.com/node-casbin/sequelize-adapter/actions/workflows/ci.yml/badge.svg)](https://github.com/node-casbin/sequelize-adapter/actions/workflows/ci.yml)\n[![Coverage Status](https://coveralls.io/repos/github/node-casbin/sequelize-adapter/badge.svg?branch=master)](https://coveralls.io/github/node-casbin/sequelize-adapter?branch=master)\n[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord\u0026label=discord\u0026color=5865F2)](https://discord.gg/S5UjpzGZjN)\n\n[npm-image]: https://img.shields.io/npm/v/casbin-sequelize-adapter.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/casbin-sequelize-adapter\n[download-image]: https://img.shields.io/npm/dm/casbin-sequelize-adapter.svg?style=flat-square\n[download-url]: https://npmjs.org/package/casbin-sequelize-adapter\n\nSequelize Adapter is the [Sequelize](https://github.com/sequelize/sequelize) adapter for [Node-Casbin](https://github.com/casbin/node-casbin). With this library, Node-Casbin can load policy from Sequelize supported database or save policy to it.\n\nBased on [Officially Supported Databases](http://docs.sequelizejs.com/), the current supported databases are:\n\n- PostgreSQL\n- MySQL\n- SQLite\n- MSSQL\n\nYou may find other 3rd-party supported DBs in Sequelize website or other places.\n\n## Installation\n\nNPM Install\n\n```bash\nnpm install casbin-sequelize-adapter --save\n```\n\nYarn Install\n\n```bash\nyarn add casbin-sequelize-adapter\n```\n\n## Testing Locally\n\nStart mysql for tests:\n\n```bash\ndocker compose up -d\n```\n\n```bash\nyarn test\n```\n\n## Simple Example\n\n```typescript\nimport casbin from 'casbin';\nimport { SequelizeAdapter } from 'casbin-sequelize-adapter';\n\nasync function myFunction() {\n  // Initialize a Sequelize adapter and use it in a Node-Casbin enforcer:\n  // The adapter can not automatically create database.\n  // But the adapter will automatically and use the table named \"casbin_rule\".\n  // The second boolean argument: autoCreateTable determines whether the adapter will automatically create the \"casbin_rule\" table.\n  // ORM should not create databases automatically.\n  const a = await SequelizeAdapter.newAdapter(\n    {\n      username: 'root',\n      password: '',\n      database: 'casbin',\n      dialect: 'mysql',\n    },\n    true,\n  );\n\n  const e = await casbin.newEnforcer('examples/rbac_model.conf', a);\n\n  // Check the permission.\n  e.enforce('alice', 'data1', 'read');\n\n  // Modify the policy.\n  // await e.addPolicy(...);\n  // await e.removePolicy(...);\n\n  // Save the policy back to DB.\n  await e.savePolicy();\n}\n```\n\n## Getting Help\n\n- [Node-Casbin](https://github.com/casbin/node-casbin)\n\n## License\n\nThis project is under Apache 2.0 License. See the [LICENSE](LICENSE) file for the full license text.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-casbin%2Fsequelize-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnode-casbin%2Fsequelize-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-casbin%2Fsequelize-adapter/lists"}