{"id":21008516,"url":"https://github.com/luk4z7/middleware-acl","last_synced_at":"2025-05-15T02:32:18.520Z","repository":{"id":49778474,"uuid":"110292500","full_name":"luk4z7/middleware-acl","owner":"luk4z7","description":"middleware-acl Access Control Library RBAC casbin","archived":false,"fork":false,"pushed_at":"2017-11-14T04:49:33.000Z","size":13,"stargazers_count":167,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-03T02:51:14.898Z","etag":null,"topics":["acl","api","casbin","middeware","rest"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luk4z7.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-10T21:04:36.000Z","updated_at":"2025-03-18T06:23:14.000Z","dependencies_parsed_at":"2022-08-29T14:30:14.217Z","dependency_job_id":null,"html_url":"https://github.com/luk4z7/middleware-acl","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luk4z7%2Fmiddleware-acl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luk4z7%2Fmiddleware-acl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luk4z7%2Fmiddleware-acl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luk4z7%2Fmiddleware-acl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luk4z7","download_url":"https://codeload.github.com/luk4z7/middleware-acl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254262413,"owners_count":22041412,"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":["acl","api","casbin","middeware","rest"],"created_at":"2024-11-19T09:12:43.976Z","updated_at":"2025-05-15T02:32:18.274Z","avatar_url":"https://github.com/luk4z7.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# middleware-acl\n\n### Getting started\n\nClone the repository in folder do you prefer\n```bash\ncd /var/www\ngit clone https://github.com/luk4z7/middleware-acl\n```\n\n**Execute the file `init.sh` for up the docker containers**\n\n```bash\n\nhttps://github.com/luk4z7/middleware-acl for the canonical source repository\nLucas Alves 2017 (c) Middleware Access Control Library - Authorization API\n\n\n           _     _     _ _                                              _\n _ __ ___ (_) __| | __| | | _____      ____ _ _ __ ___        __ _  ___| |\n| '_ ` _ \\| |/ _` |/ _` | |/ _ \\ \\ /\\ / / _` | '__/ _ \\_____ / _` |/ __| |\n| | | | | | | (_| | (_| | |  __/\\ V  V / (_| | | |  __/_____| (_| | (__| |\n|_| |_| |_|_|\\__,_|\\__,_|_|\\___| \\_/\\_/ \\__,_|_|  \\___|      \\__,_|\\___|_|\n\nmiddleware\n\nDOCKER\nGenerate new containers ? [ 1 ]\nDelete all containers ?   [ 2 ]\nStart new build ?         [ 3 ]\nPreview the logs ?        [ 4 ]\nInstall dependencies ?    [ 5 ]\nUpdate dependencies ?     [ 6 ]\n\n```\n\nFirst step\n```bash\nStart new build          [ 3 ]\n```\n\nSecond step\n```bash\nGenerate new containers  [ 1 ]\n```\n\nPreview the all logs of containers\n```bash\nPreview the logs         [ 4 ]\n```\n\nOr access the single container\n```bash\ndocker logs api -f\n```\n```bash\ndocker logs mongo -f\n```\n\n### API REST\n\n**Routers**\n\nIn this examples I using jq for pretty the result, for more information view in : [jq](https://stedolan.github.io/jq/)\n\n**List Role**\n```bash\ncurl -H \"Content-Type: application/json\" -X GET http://127.0.0.1:6060/v1/roles | jq\n```\n\n**Create Role and User**\n```bash\ncurl -H \"Content-Type: application/json\" -X POST -d '{\"user\":\"alice\", \"role\":\"visitante\"}' http://127.0.0.1:6060/v1/roles | jq\n```\n\n**Get role and its permissions**\n```bash\ncurl -H \"Content-Type: application/json\" -X GET http://127.0.0.1:6060/v1/roles/alice | jq\n```\n\n**Update role (add permissions)**\n```bash\ncurl -H \"Content-Type: application/json\" -X PUT -d '{\"user\":\"alice\", \"permission\": \"read\"}' http://127.0.0.1:6060/v1/roles | jq\n```\n\n**Delete role**\n```bash\ncurl -H \"Content-Type: application/json\" -X DELETE http://127.0.0.1:6060/v1/roles/administrador | jq\n```\n\n**List user roles**\n```bash\ncurl -H \"Content-Type: application/json\" -X GET http://127.0.0.1:6060/v1/users/alice/roles | jq\n```\n\n**Remove role from user**\n```bash\ncurl -H \"Content-Type: application/json\" -X DELETE http://127.0.0.1:6060/v1/users/alice/roles/visitante3 | jq\n```\n\n**Check user permission**\n```bash\ncurl -H \"Content-Type: application/json\" -X GET http://127.0.0.1:6060/v1/users/alice/resource/data1/permission/read | jq\n```\n\n### Tests\n\nAccess the container\n```bash\ndocker exec -it api bash\n```\n\n```bash\ncd /go/src/middleware\n```\n\nand execute this:\n```bash\n./coverage.sh --html\n```\nand so, the file `html` is generated, only copy the file for the current directory\n```bash\ncp /tmp/cover314639520/coverage.html .\n```\n\nAccess the html file inside the project folder outside the container","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluk4z7%2Fmiddleware-acl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluk4z7%2Fmiddleware-acl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluk4z7%2Fmiddleware-acl/lists"}