command
module
Version:
v1.12.0
Opens a new window with list of versions in this module.
Published: Sep 7, 2025
License: Apache-2.0
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
casbin-go-cli

casbin-go-cli is a command-line tool based on Casbin (Go language), enabling you to use all of Casbin APIs in the shell.
Installation
- Clone project from repository
git clone https://github.com/casbin/casbin-go-cli.git
- Build project
cd casbin-go-cli
go build -o casbin
Options
| options |
description |
must |
-m, --model |
The path of the model file or model text |
y |
-p, --policy |
The path of the policy file or policy text |
y |
enforce |
Check permissions |
n |
enforceEx |
Check permissions and get which policy it is |
n |
Get started
-
Check whether Alice has read permission on data1
./casbin enforce -m "test/basic_model.conf" -p "test/basic_policy.csv" "alice" "data1" "read"
{"allow":true,"explain":[]}
-
Check whether Alice has write permission for data1 (with explanation)
./casbin enforceEx -m "test/basic_model.conf" -p "test/basic_policy.csv" "alice" "data1" "write"
{"allow":false,"explain":[]}
-
Check whether Alice has read permission on data1 in domain1 (with explanation)
./casbin enforceEx -m "test/rbac_with_domains_model.conf" -p "test/rbac_with_domains_policy.csv" "alice" "domain1" "data1" "read"
{"allow":true,"explain":["admin","domain1","data1","read"]}
Documentation
¶
There is no documentation for this package.
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.