{"id":22558751,"url":"https://github.com/mithereal/ecto-role","last_synced_at":"2025-04-10T06:36:02.752Z","repository":{"id":57493637,"uuid":"116995981","full_name":"mithereal/ecto-role","owner":"mithereal","description":"assign roles to your tables","archived":false,"fork":false,"pushed_at":"2019-02-01T23:26:41.000Z","size":196,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T07:39:59.835Z","etag":null,"topics":["elixir","elixir-library"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/mithereal.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-10T18:35:41.000Z","updated_at":"2023-07-25T14:14:08.000Z","dependencies_parsed_at":"2022-08-28T15:14:02.247Z","dependency_job_id":null,"html_url":"https://github.com/mithereal/ecto-role","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mithereal%2Fecto-role","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mithereal%2Fecto-role/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mithereal%2Fecto-role/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mithereal%2Fecto-role/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mithereal","download_url":"https://codeload.github.com/mithereal/ecto-role/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248074921,"owners_count":21043490,"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":["elixir","elixir-library"],"created_at":"2024-12-07T20:16:53.722Z","updated_at":"2025-04-10T06:36:02.692Z","avatar_url":"https://github.com/mithereal.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EctoRole\n\n[![Build Status](https://travis-ci.org/mithereal/ecto-role.svg?branch=master)](https://travis-ci.org/mithereal/ecto-role)\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmithereal%2Fecto-role.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmithereal%2Fecto-role?ref=badge_shield)\n\n[![Inline docs](http://inch-ci.org/github/mithereal/ecto-role.svg)](http://inch-ci.org/github/mithereal/ecto-role)\n\n** Ecto-Role: Implement Table, Row and Column Locking(ish) via OTP **\n\nAdd Role based authentication to your otp app. Ecto-Role Provides a simple way to create and assign roles to users\n\nEcto-Role creates a few schemas to track roles and entities,\n\nEntities are a object we are assiging the role to, entities have a uuid.\n\nSchemas represent the schema and its fields/filters -- filters is a list of all filters relating to the schema\n\na filter has a name, which fields are filtered in the result and if create/delete actions can/not happen\n\nwe have a few different ways of looking at this:\n\n* Entities have roles which have filters\n* Roles have entities and filters\n* Schemas have fields (row_names) and filters\n* filters explain how to filter data/actions\n\nBy using the entity instead of user we can have many different filters/filters for different objects and by holding this information in an otp app we can easily query for the filters on the entity with no need to hit the database \n\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `ecto_role` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:ecto_role, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\n## How to Use\n\nyou can query the otp app to see if the entity has the necessary role to access the db record, and/or filter the result of the query\n\nentity_uuid = \"xxx-xxx-xxx-xxx\"\nrole_uuid = \"xxx-xxx-xxx-xxx\"\nrole = EctoRole.role?(\"entity_uuid\", role_uuid )\n# {:ok,_}, {:error,_}\nquery_result = %{SCHEMA}\nresult = case role do\n{:ok,_} -\u003e EctoRole.filter(\"filter_uuid\", query_result)\n{:error,e} -\u003e {:error,e}\nend \n\n  \nDocumentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)\nand published on [HexDocs](https://hexdocs.pm). Once published, the docs can\nbe found at [https://hexdocs.pm/ecto_role](https://hexdocs.pm/ecto_role).\n\n\n\n## License\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmithereal%2Fecto-role.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmithereal%2Fecto-role?ref=badge_large)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmithereal%2Fecto-role","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmithereal%2Fecto-role","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmithereal%2Fecto-role/lists"}