{"id":18994085,"url":"https://github.com/confact/lucky_can","last_synced_at":"2025-04-22T12:48:00.798Z","repository":{"id":141114703,"uuid":"249757314","full_name":"confact/lucky_can","owner":"confact","description":"A simple pundit policies library for Lucky Framework in Crystal","archived":false,"fork":false,"pushed_at":"2020-03-24T16:41:41.000Z","size":3,"stargazers_count":11,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T14:19:14.463Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Crystal","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/confact.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-24T16:19:16.000Z","updated_at":"2020-12-30T12:52:29.000Z","dependencies_parsed_at":"2024-07-23T05:07:19.070Z","dependency_job_id":null,"html_url":"https://github.com/confact/lucky_can","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/confact%2Flucky_can","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/confact%2Flucky_can/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/confact%2Flucky_can/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/confact%2Flucky_can/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/confact","download_url":"https://codeload.github.com/confact/lucky_can/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249265280,"owners_count":21240550,"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":[],"created_at":"2024-11-08T17:24:06.927Z","updated_at":"2025-04-22T12:48:00.788Z","avatar_url":"https://github.com/confact.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lucky_can\n\nAn little nicer way to handle authorization rules for your lucky app\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n   ```yaml\n   dependencies:\n     lucky_can:\n       github: confact/lucky_can\n   ```\n\n2. Run `shards install`\n\n## Usage\n\n1. ```crystal\n    require \"lucky_can\"\n   ```\n\n2. create an `policies` directory where all your policies will be. Now you will Add an require for that directory to the app.cr file before `pages` require. Add this: `require \"./policies/**\"`\n\n3. now you can create your policies in `policies` directory.\n\n\n### Simple usage\n\n```crystal\nclass TeamPolicy \u003c LuckyCan::BasePolicy\n  can show, team, current_user do\n    return false if current_user.nil?\n    team.users.include?(current_user)\n  end\nend\n```\n\nthis generate following methods for you to use by an macro:\n* `TeamPolicy.show?(team, current_user)` - for simple bool check if the user have access to the team.\n* `TeamPolicy.show_not_found?(team, current_user, context)` - Return an Lucky::RouteNotFoundError if the code in the block return false.\n* `TeamPolicy.show_forbidden?(team, current_user, context)` - Return an LuckyCan::ForbiddenError if the code in the block return false.\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/confact/lucky_can/fork\u003e)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Håkan Nylén](https://github.com/confact) - creator and maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconfact%2Flucky_can","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconfact%2Flucky_can","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconfact%2Flucky_can/lists"}