{"id":15431018,"url":"https://github.com/exelord/monarchy","last_synced_at":"2025-04-13T02:13:21.977Z","repository":{"id":4172342,"uuid":"52164909","full_name":"Exelord/Monarchy","owner":"Exelord","description":"Hierarchical access management system with advanced roles inheritance. 🦋","archived":false,"fork":false,"pushed_at":"2022-12-14T07:23:39.000Z","size":11946,"stargazers_count":47,"open_issues_count":12,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T02:13:16.930Z","etag":null,"topics":["access","access-control","authorization","monarchy","rails","roles","roles-inheritance","ruby"],"latest_commit_sha":null,"homepage":"https://exelord.github.io/Monarchy/","language":"Ruby","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/Exelord.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-20T17:09:42.000Z","updated_at":"2025-02-08T12:39:46.000Z","dependencies_parsed_at":"2023-01-13T12:58:49.731Z","dependency_job_id":null,"html_url":"https://github.com/Exelord/Monarchy","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Exelord%2FMonarchy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Exelord%2FMonarchy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Exelord%2FMonarchy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Exelord%2FMonarchy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Exelord","download_url":"https://codeload.github.com/Exelord/Monarchy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248654094,"owners_count":21140236,"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":["access","access-control","authorization","monarchy","rails","roles","roles-inheritance","ruby"],"created_at":"2024-10-01T18:19:59.886Z","updated_at":"2025-04-13T02:13:21.954Z","avatar_url":"https://github.com/Exelord.png","language":"Ruby","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"monarchy.png?raw=true\" alt=\"Sublime's custom image\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://travis-ci.org/Exelord/Monarchy\"\u003e\n    \u003cimg src=\"https://travis-ci.org/Exelord/Monarchy.svg?branch=master\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://gitter.im/Exelord/Monarchy?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\"\u003e\n    \u003cimg src=\"https://badges.gitter.im/Exelord/Monarchy.svg\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://codeclimate.com/github/Exelord/Monarchy\"\u003e\n    \u003cimg src=\"https://codeclimate.com/github/Exelord/Monarchy/badges/gpa.svg\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://codeclimate.com/github/Exelord/Monarchy/coverage\"\u003e\n    \u003cimg src=\"https://codeclimate.com/github/Exelord/Monarchy/badges/coverage.svg\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nMonarchy is a ruby gem offering a complete solution to manage an authorization access in Ruby on Rails applications. A hierarchical structure as well as built-in roles inheritance options make it the most powerful tool to control access to application data resources.\n\nThanks to [closure_tree](https://github.com/mceachen/closure_tree) - a gem used to manage binary trees - Monarchy can deliver the best-in-class algorithmic performance and enables developers to forget about hierarchies and complicated structures.\n\nIf you feel limited while using rolify, feel free to use Monarchy with its advanced capacity to inherit roles and collect all accessible resources with just one method.\n\n## Usage Example\nAfter Monarchy setup you can enjoy with roles inheritance and accessible resources.\n\n```ruby\n# Create roles\nadmin_role = Monarchy.role_class.create(name: :admin, level: 5, inherited: true)\nmanager_role = Monarchy.role_class.create(name: :manager, level: 4, inherited_role: admin_role, inherited: true)\n\n# Create resources\nproject1 = Project.create()\nproject2 = Project.create(parent: project1)\nproject3 = Project.create(parent: project2)\nproject4 = Project.create(parent: project1)\n\n# Grant user\nuser.grant(:manager, project2)\n\n# Accessible projects\nProject.accessible_for(user)  # returns [project1, project2, project3]\n\n# User inherited roles\nuser.roles_for(project1) # returns a default role eg. [guest_role]\nuser.roles_for(project2) # returns [manager_role]\nuser.roles_for(project3) # returns [admin_role]\nuser.roles_for(project4) # returns empty array []\n\n# Graphical visualization\n\n#                              project1 (default role, eg. guest)\n#                                 |\n#                                 |\n#   (granted as manager) project2   project4 (no access)\n#                           |\n#                           |\n#                        project3 (admin | inherited role from manager_role)\n```\n\n## Requirements\nMonarchy requires:\n  - Ruby 2.3\n\n## Documentation\nWe are preparing an official [website][5c7e0096] with documentation.\nMeanwhile you can look to the `docs` directory for actual [documentation](https://github.com/Exelord/Monarchy/tree/master/docs).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/exelord/Monarchy. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.\n\n## License\n\nThis version of the gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n[5c7e0096]: https://exelord.github.io/Monarchy/ \"Monarchy Website\"\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexelord%2Fmonarchy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexelord%2Fmonarchy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexelord%2Fmonarchy/lists"}