{"id":21252616,"url":"https://github.com/jcasbin/casbin-java-cli","last_synced_at":"2025-07-20T12:06:09.357Z","repository":{"id":251305540,"uuid":"835036056","full_name":"jcasbin/casbin-java-cli","owner":"jcasbin","description":"Java CLI for jCasbin","archived":false,"fork":false,"pushed_at":"2025-01-23T10:09:48.000Z","size":62,"stargazers_count":3,"open_issues_count":2,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-05T19:12:13.427Z","etag":null,"topics":["abac","acl","auth","authorization","authz","casbin","cli","client","java","jcasbin","permission","rbac","sdk"],"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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-29T03:06:55.000Z","updated_at":"2025-01-23T10:08:50.000Z","dependencies_parsed_at":"2024-11-11T17:24:49.236Z","dependency_job_id":"058136bd-6763-4cb5-8c4f-2de9a92f3591","html_url":"https://github.com/jcasbin/casbin-java-cli","commit_stats":null,"previous_names":["jcasbin/casbin-java-cli"],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/jcasbin/casbin-java-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcasbin%2Fcasbin-java-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcasbin%2Fcasbin-java-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcasbin%2Fcasbin-java-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcasbin%2Fcasbin-java-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcasbin","download_url":"https://codeload.github.com/jcasbin/casbin-java-cli/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcasbin%2Fcasbin-java-cli/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266120407,"owners_count":23879314,"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","acl","auth","authorization","authz","casbin","cli","client","java","jcasbin","permission","rbac","sdk"],"created_at":"2024-11-21T03:48:07.114Z","updated_at":"2025-07-20T12:06:09.335Z","avatar_url":"https://github.com/jcasbin.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# casbin-java-cli\n\n[![build](https://github.com/jcasbin/casbin-java-cli/actions/workflows/maven-ci.yml/badge.svg)](https://github.com/jcasbin/casbin-java-cli/actions/workflows/maven-ci.yml)\n[![codecov](https://codecov.io/gh/jcasbin/casbin-java-cli/branch/master/graph/badge.svg?token=pKOEodQ3q9)](https://app.codecov.io/github/jcasbin/casbin-java-cli)\n[![Release](https://img.shields.io/github/release/jcasbin/casbin-java-cli.svg)](https://github.com/jcasbin/casbin-java-cli/releases/latest)\n[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord\u0026label=discord\u0026color=5865F2)](https://discord.gg/S5UjpzGZjN)\n\ncasbin-java-cli is a command-line tool based on jcasbin, enabling you to use all of jcasbin's APIs in the shell.\n\n## Installation\n\n1. Clone project from repository\n\n``` shell\ngit clone https://github.com/jcasbin/casbin-java-cli.git\n```\n\n2. Build project, the jar package will be generated in the `target` directory\n\n``` shell\ncd casbin-java-cli\nmvn clean install\n```\n\n## Options\n| options               | description                                  | must | remark                                                    |\n|-----------------------|----------------------------------------------|------|-----------------------------------------------------------|\n| `-m, --model`         | The path of the model file or model text     | y    | Please wrap it with `\"\"` and separate each line with `\\|` |\n| `-p, --policy`        | The path of the policy file or policy text   | y    | Please wrap it with `\"\"` and separate each line with `\\|` |          \n| `-e, --enforce`       | Check permissions                            | n    | Please wrap it with `\"\"`                                  |\n| `-ex, --enforceEx`    | Check permissions and get which policy it is | n    | Please wrap it with `\"\"`                                  |\n| `-AF, --addFuntion`   | Add custom funtion                           | n    | Please wrap it with `\"\"` and separate each line with `\\|` |\n| `-ap, --addPolicy`    | Add a policy rule to the policy file         | n    | Please wrap it with `\"\"`                                  |\n| `-rp, --removePolicy` | Remove a policy rule from the policy file    | n    | Please wrap it with `\"\"`                                  |\n\n## Get started\n\n- Check whether Alice has read permission on data1\n\n    ```shell\n    ./casbin enforce -m \"examples/rbac_model.conf\" -p \"examples/rbac_policy.csv\" \"alice\" \"data1\" \"read\"\n    ```\n    \u003e {\"allow\":true,\"explain\":null}\n    ```shell\n    ./casbin enforce -m \"[request_definition]\\nr = sub, obj, act\\n[policy_definition]\\np = sub, obj, act\\n[role_definition]\\ng = _, _\\n[policy_effect]\\ne = some(where (p.eft == allow))\\n[matchers]\\nm = g(r.sub, p.sub) \u0026\u0026 r.obj == p.obj \u0026\u0026 r.act == p.act\" -p \"p, alice, data1, read\\np, bob, data2, write\\np, data2_admin, data2, read\\np, data2_admin, data2, write\\ng, alice, data2_admin\" \"alice\" \"data1\" \"read\"\n    ```\n    \u003e {\"allow\":true,\"explain\":null}\n\n- Check whether Alice has write permission for data2. If so, display the effective policy.\n\n    ```shell\n    ./casbin enforceEx -m \"examples/rbac_model.conf\" -p \"examples/rbac_policy.csv\" \"alice\" \"data2\" \"write\"\n    ```\n    \u003e {\"allow\":true,\"explain\":[\"data2_admin\",\"data2\",\"write\"]}\n\n- Add a policy to the policy file\n\n    ```shell\n    ./casbin addPolicy -m \"examples/rbac_model.conf\" -p \"examples/rbac_policy.csv\" \"alice\" \"data2\" \"write\"\n    ```\n    \u003e {\"allow\":true,\"explain\":null}\n\n- Delete a policy from the policy file\n\n    ```shell\n    ./casbin removePolicy -m \"examples/rbac_model.conf\" -p \"examples/rbac_policy.csv\" \"alice\" \"data2\" \"write\"\n    ```\n    \u003e {\"allow\":true,\"explain\":null}\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcasbin%2Fcasbin-java-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcasbin%2Fcasbin-java-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcasbin%2Fcasbin-java-cli/lists"}