{"id":19788379,"url":"https://github.com/m19c/acl","last_synced_at":"2025-10-05T11:18:39.105Z","repository":{"id":57518108,"uuid":"155064118","full_name":"m19c/acl","owner":"m19c","description":"a lightweight acl manager for go.","archived":false,"fork":false,"pushed_at":"2023-07-18T19:58:32.000Z","size":41,"stargazers_count":82,"open_issues_count":1,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-14T10:37:48.852Z","etag":null,"topics":["access-control","acl","go","golang","role"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/m19c.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2018-10-28T11:33:01.000Z","updated_at":"2025-05-13T10:23:19.000Z","dependencies_parsed_at":"2024-06-20T01:42:50.126Z","dependency_job_id":"25709137-60fb-461c-8b26-f801ce1b9fbc","html_url":"https://github.com/m19c/acl","commit_stats":null,"previous_names":["mrboolean/acl"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/m19c/acl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m19c%2Facl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m19c%2Facl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m19c%2Facl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m19c%2Facl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m19c","download_url":"https://codeload.github.com/m19c/acl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m19c%2Facl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278444552,"owners_count":25987790,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["access-control","acl","go","golang","role"],"created_at":"2024-11-12T06:27:11.296Z","updated_at":"2025-10-05T11:18:39.086Z","avatar_url":"https://github.com/m19c.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ACL\n\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/07072bf48e3d43c09213781a56553a5d)](https://app.codacy.com/app/mrboolean/acl?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=MrBoolean/acl\u0026utm_campaign=Badge_Grade_Dashboard)\n[![Build Status](https://travis-ci.org/MrBoolean/acl.svg?branch=master)](https://travis-ci.org/MrBoolean/acl)\n[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/04065034d8b6496c95acd7b5b056b940)](https://www.codacy.com/app/mrboolean/acl?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=MrBoolean/acl\u0026amp;utm_campaign=Badge_Coverage)\n[![Documentation](https://godoc.org/github.com/MrBoolean/acl?status.svg)](http://godoc.org/github.com/MrBoolean/acl)\n\n\n## TL;DR;\n\n_acl_ is a lightweight acl manager for _go_.\n\n## Features\n\n- Design simple \u0026 reusable roles to empower your application.\n- Acquire the rights of other roles to build a powerful set of permissions.\n- Resolve possible roles by examine them in an unified way.\n\n## Example\n\n```go\ntype User struct {\n    isAdmin bool\n}\n\nfunc main() {\n    // first of all: create a new manager instance to register all your roles in one place\n    manager := acl.NewManager()\n\n    // now you can use `Ensure` to guarantee that the role with the passed identifier is present\n    user := manager.Ensure(\"user\").Grant(\"profile.edit\")\n    // use `Grant`, `Revoke` and `AcquireFrom` to extend the right stack\n    editor := manager.Ensure(\"editor\").Grant(\"news.list\", \"news.create\", \"news.edit\").AcquireFrom(user)\n\n    // you can also use NewRole to create a Role manually\n    admin := acl.NewRole(\"admin\").Grant(\"news.delete\").AcquireFrom(editor)\n    // note, that you have to register the role by yourself\n    manager.Register(admin)\n\n    // to check if a right was granted to a role you can use:\n    var hasAccess bool\n    hasAccess = admin.Has(\"some.right\")\n\n    // to check if at least one of the expected rights is present:\n    hasAccess = admin.HasOneOf(\"news.list\", \"news.create\")\n\n    // ... and finally, to check that all the expected rights are present, use:\n    hasAccess = admin.HasAllOf(\"news.delete\", \"news.list\")\n\n    // a role can be extended with an examiner to determine whether a role can be added\n    // to a `ResultSet`\n    admin.SetExaminer(func (payload interface{}) bool {\n        user := payload.(User)\n        return user.isAdmin\n    })\n\n    // to get a result set you can use the managers `Examine` function\n    rs := manager.Examine(User{isAdmin: true})\n\n    // a result set contains \"Has\", \"HasOneOf\" and \"HasAllOf\" as described above and...\n    // `GetRole` to grab specific roles from the result set\n    expectedRole := rs.GetRole(\"admin\")\n\n    // you can also check if a role was added to a result set using:\n    if rs.HasRole(\"admin\") {\n        // ...\n    }\n}\n```\n\n## Possible enhancements\n\n- Conditional `IsAllowed` (combine AND/OR queries into a _ConditionGroup_).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm19c%2Facl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm19c%2Facl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm19c%2Facl/lists"}