middleware-acl

middleware-acl Access Control Library RBAC casbin

  • 所有者: luk4z7/middleware-acl
  • 平台:
  • 許可證: BSD 3-Clause "New" or "Revised" License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

middleware-acl

Getting started

Clone the repository in folder do you prefer

cd /var/www
git clone https://github.com/luk4z7/middleware-acl

Execute the file init.sh for up the docker containers


https://github.com/luk4z7/middleware-acl for the canonical source repository
Lucas Alves 2017 (c) Middleware Access Control Library - Authorization API


           _     _     _ _                                              _
 _ __ ___ (_) __, __, _____      ____ _ _ __ ___        __ _  ___, '_ ` _ \, / _`, / _`, / _ \ \ /\ / / _`, '__/ _ \_____ / _`, / __, (_, (_, __/\ V  V / (_, __/_____, (_, (__, _, _, _, _, \__,_, \__,_, _, \___, \_/\_/ \__,_, _, \___, \__,_, \___, _, middleware

DOCKER
Generate new containers ? [ 1 ]
Delete all containers ?   [ 2 ]
Start new build ?         [ 3 ]
Preview the logs ?        [ 4 ]
Install dependencies ?    [ 5 ]
Update dependencies ?     [ 6 ]

First step

Start new build          [ 3 ]

Second step

Generate new containers  [ 1 ]

Preview the all logs of containers

Preview the logs         [ 4 ]

Or access the single container

docker logs api -f
docker logs mongo -f

API REST

Routers

In this examples I using jq for pretty the result, for more information view in : jq

List Role

curl -H "Content-Type: application/json" -X GET http://127.0.0.1:6060/v1/roles, jq

Create Role and User

curl -H "Content-Type: application/json" -X POST -d '{"user":"alice", "role":"visitante"}' http://127.0.0.1:6060/v1/roles, jq

Get role and its permissions

curl -H "Content-Type: application/json" -X GET http://127.0.0.1:6060/v1/roles/alice, jq

Update role (add permissions)

curl -H "Content-Type: application/json" -X PUT -d '{"user":"alice", "permission": "read"}' http://127.0.0.1:6060/v1/roles, jq

Delete role

curl -H "Content-Type: application/json" -X DELETE http://127.0.0.1:6060/v1/roles/administrador, jq

List user roles

curl -H "Content-Type: application/json" -X GET http://127.0.0.1:6060/v1/users/alice/roles, jq

Remove role from user

curl -H "Content-Type: application/json" -X DELETE http://127.0.0.1:6060/v1/users/alice/roles/visitante3, jq

Check user permission

curl -H "Content-Type: application/json" -X GET http://127.0.0.1:6060/v1/users/alice/resource/data1/permission/read, jq

Tests

Access the container

docker exec -it api bash
cd /go/src/middleware

and execute this:

./coverage.sh --html

and so, the file html is generated, only copy the file for the current directory

cp /tmp/cover314639520/coverage.html .

Access the html file inside the project folder outside the container

主要指標

概覽
名稱與所有者luk4z7/middleware-acl
主編程語言Go
編程語言Shell (語言數: 2)
平台
許可證BSD 3-Clause "New" or "Revised" License
所有者活动
創建於2017-11-10 21:04:36
推送於2017-11-14 04:49:33
最后一次提交2017-11-14 01:49:37
發布數1
最新版本名稱v1.0.0 (發布於 )
第一版名稱v1.0.0 (發布於 )
用户参与
星數166
關注者數3
派生數6
提交數2
已啟用問題?
問題數1
打開的問題數1
拉請求數0
打開的拉請求數0
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?