{"id":22312243,"url":"https://github.com/willsoto/casbin-objection-adapter","last_synced_at":"2026-03-12T17:01:52.617Z","repository":{"id":36973438,"uuid":"262403425","full_name":"willsoto/casbin-objection-adapter","owner":"willsoto","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-21T00:05:56.000Z","size":3280,"stargazers_count":9,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T17:44:29.843Z","etag":null,"topics":["casbin","casbin-adapter","knex","objectionjs"],"latest_commit_sha":null,"homepage":"","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/willsoto.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["willsoto"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2020-05-08T18:49:38.000Z","updated_at":"2024-01-12T18:13:11.000Z","dependencies_parsed_at":"2024-02-20T00:25:22.144Z","dependency_job_id":"cf558a38-cb71-4fc9-9b7a-7c1f7bcafb60","html_url":"https://github.com/willsoto/casbin-objection-adapter","commit_stats":{"total_commits":900,"total_committers":5,"mean_commits":180.0,"dds":0.28,"last_synced_commit":"4d78919da36a599768bf8a615cd42cdd2e2df778"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/willsoto/casbin-objection-adapter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willsoto%2Fcasbin-objection-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willsoto%2Fcasbin-objection-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willsoto%2Fcasbin-objection-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willsoto%2Fcasbin-objection-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willsoto","download_url":"https://codeload.github.com/willsoto/casbin-objection-adapter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willsoto%2Fcasbin-objection-adapter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30434076,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T14:34:45.044Z","status":"ssl_error","status_checked_at":"2026-03-12T14:09:33.793Z","response_time":114,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["casbin","casbin-adapter","knex","objectionjs"],"created_at":"2024-12-03T21:35:52.129Z","updated_at":"2026-03-12T17:01:52.599Z","avatar_url":"https://github.com/willsoto.png","language":"TypeScript","funding_links":["https://github.com/sponsors/willsoto"],"categories":[],"sub_categories":[],"readme":"# Casbin Objection Adapter\n\n![tests](https://github.com/willsoto/casbin-objection-adapter/workflows/tests/badge.svg)\n\n\u003c!-- prettier-ignore-start --\u003e\n\n\u003c!-- toc --\u003e\n\n- [Installation](#installation)\n- [Basic usage](#basic-usage)\n- [Advanced usage](#advanced-usage)\n\n\u003c!-- tocstop --\u003e\n\n\u003c!-- prettier-ignore-end --\u003e\n\n## Installation\n\n```bash\nnpm install @willsoto/casbin-objection-adapter --save\n```\n\n```bash\nyarn add @willsoto/casbin-objection-adapter\n```\n\n```bash\npnpm add @willsoto/casbin-objection-adapter\n```\n\n## Basic usage\n\nSee [the Casbin adapters documentation](https://casbin.org/docs/en/adapters) for more information.\n\n```js\nimport { Knex } from \"knex\";\nimport { newEnforcer } from \"casbin\";\nimport { ObjectionAdapter } from \"@willsoto/casbin-objection-adapter\";\n\nconst knex = Knex({\n  /* regular knex options */\n});\n\n// All configuration is optional\nconst adapter = await ObjectionAdapter.newAdapter(knex, {});\n\n// Create the enforcer with the given model\nconst enforcer = await newEnforcer(\"basic_model.conf\", adapter);\n\n// Supports auto-save\n// See: https://casbin.org/docs/en/adapters#autosave\nenforcer.enableAutoSave(true);\n\n// No need to save explicitly since auto-save is enabled\nawait enforcer.addPolicies([\n  [\"alice\", \"data1\", \"read\"],\n  [\"bob\", \"data2\", \"write\"],\n]);\n\nawait enforcer.enforce(\"alice\", \"data1\", \"read\"); // true\nawait enforcer.enforce(\"bob\", \"data1\", \"read\"); // false\n```\n\n## Advanced usage\n\nThe following options are available:\n\n| Option        | Default value | Description                                                                                                     |\n| ------------- | ------------- | --------------------------------------------------------------------------------------------------------------- |\n| `createTable` | `true`        | Whether or not to create the table when initialized.                                                            |\n| `modelClass`  | `CasbinRule`  | The model to use when querying policies. You can override this if you would like to control the table name      |\n| `logger`      | `noop`        | An optional logger in case additional visiblity is needed into the adapter. The inteface should match `console` |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillsoto%2Fcasbin-objection-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillsoto%2Fcasbin-objection-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillsoto%2Fcasbin-objection-adapter/lists"}