{"id":19861280,"url":"https://github.com/sirscriptalot/polizia","last_synced_at":"2026-05-13T04:43:29.390Z","repository":{"id":56888442,"uuid":"120672040","full_name":"sirscriptalot/polizia","owner":"sirscriptalot","description":null,"archived":false,"fork":false,"pushed_at":"2018-02-07T23:19:49.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-11T14:49:12.016Z","etag":null,"topics":["authorization"],"latest_commit_sha":null,"homepage":null,"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/sirscriptalot.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-02-07T21:09:58.000Z","updated_at":"2018-04-29T10:27:07.000Z","dependencies_parsed_at":"2022-08-20T23:40:48.189Z","dependency_job_id":null,"html_url":"https://github.com/sirscriptalot/polizia","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/sirscriptalot%2Fpolizia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sirscriptalot%2Fpolizia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sirscriptalot%2Fpolizia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sirscriptalot%2Fpolizia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sirscriptalot","download_url":"https://codeload.github.com/sirscriptalot/polizia/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241263404,"owners_count":19936057,"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":["authorization"],"created_at":"2024-11-12T15:08:32.883Z","updated_at":"2026-05-13T04:43:29.317Z","avatar_url":"https://github.com/sirscriptalot.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Polizia\n\nA small authorization library for implementing \"policy\" objects.\nPolizia is a minimal clone of the popular Pundit gem.\n\n## Installation\n\n`gem install polizia`\n\n## Usage\n\n```ruby\nrequire 'polizia'\n\nclass Account\n  attr_accessor :user\n\n  def initialize(user:)\n    @user = user\n  end\nend\n\nclass AccountPolicy \u003c Polizia\n  def create?\n    user.guest?\n  end\n\n  def update?(account)\n    account.user == user\n  end\n\n  def delete?(account)\n    account.user == user\n  end\nend\n\nclass User\n  def guest?\n    false\n  end\nend\n\nuser = User.new\n\naccount = Account.new(user: user)\n\npolicy = AccountPolicy.new(user)\n\npolicy.create? # false\n\npolicy.update?(account) # true\n\npolicy.delete?(account) # true\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsirscriptalot%2Fpolizia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsirscriptalot%2Fpolizia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsirscriptalot%2Fpolizia/lists"}