{"id":46095303,"url":"https://github.com/zunnu/enforcer","last_synced_at":"2026-03-01T18:35:03.259Z","repository":{"id":52218731,"uuid":"288218532","full_name":"zunnu/enforcer","owner":"zunnu","description":"Enforcer is a simple lightweight ACL plugin for CakePHP 3","archived":false,"fork":false,"pushed_at":"2022-11-16T22:01:17.000Z","size":295,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-15T06:57:21.944Z","etag":null,"topics":["acl","cakephp","cakephp-plugin","lightweight","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zunnu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-17T15:36:08.000Z","updated_at":"2022-11-27T07:39:59.000Z","dependencies_parsed_at":"2022-08-23T21:40:16.864Z","dependency_job_id":null,"html_url":"https://github.com/zunnu/enforcer","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/zunnu/enforcer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zunnu%2Fenforcer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zunnu%2Fenforcer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zunnu%2Fenforcer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zunnu%2Fenforcer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zunnu","download_url":"https://codeload.github.com/zunnu/enforcer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zunnu%2Fenforcer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29978874,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T16:35:47.903Z","status":"ssl_error","status_checked_at":"2026-03-01T16:35:44.899Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["acl","cakephp","cakephp-plugin","lightweight","php"],"created_at":"2026-03-01T18:35:02.592Z","updated_at":"2026-03-01T18:35:03.240Z","avatar_url":"https://github.com/zunnu.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Enforcer\n\nEnforcer is a simple lightweight acl plugin for CakePHP 3.x\n\n## Requirements\n* CakePHP 3.x\n* PHP 7.2 \u003e\n\n## Installing Using [Composer][composer]\n\n`cd` to the root of your app folder (where the `composer.json` file is) and run the following command:\n\n```\ncomposer require zunnu/enforcer\n```\n\nThen load the plugin by using CakePHP's console:\n\n```\n./bin/cake plugin load Enforcer\n```\n\nNext create the tables:\n\n```\n./bin/cake migrations migrate -p Enforcer\n```\n\n## Usage\nYou will need to modify your `src/Controller/AppController.php` and load the Enforcer component in the `initialize()` function\n```php\n$this-\u003eloadComponent('Enforcer.Enforcer', [\n    'unauthorizedRedirect' =\u003e [\n        'plugin' =\u003e false,\n        'controller' =\u003e 'Users',\n        'action' =\u003e 'login',\n        'prefix' =\u003e false\n    ],\n    'protectionMode' =\u003e 'everything' // everything | filters\n]);\n```\n\nThe `unauthorizedRedirect` will tell Enforcer where to redirect if the user has permission error.\nThe `protectionMode` will tell Enforcer how to handle permissions.\n\n| protectionModes | README |\n| ------ | ------ |\n| everything | Enforcer will automaticly try to protect all public controller function |\n| filters | Enforcer will protect the controllers where the protection is called from the `beforeFilter()` |\n\nIf the `protectionMode` **filters** is enabled you need to add the \n\n```php\npublic function beforeFilter(Event $event) {\n    parent::beforeFilter($event);\n    \n    // permission load\n    return $this-\u003eEnforcer-\u003ehasAccess($this-\u003erequest, $this-\u003eAuth-\u003euser());\n}\n```\n\n## Permissions\nThe migrations will create tree different groups.\nYou can add, modify or delete groups by going to\nhttp://app-address/enforcer/admin/groups/index\n\n| Groups | README |\n| ------ | ------ |\n| admin | All powerfull |\n| user | Default user group |\n| guest | Site visitors |\n\nThe default admin group should be able to access the permissions page.\nYou should be able to access the page using this url\nhttp://app-url/enforcer/admin/permissions\n\u003cimg src=\"https://imgur.com/N28gblK.png\" alt=\"Enforcer permissions\"\u003e\n\u003cbr\u003e\n\u003cimg src=\"https://i.imgur.com/VkWzlgJ.png\" alt=\"Enforcer permissions\"\u003e\n\nIf the request is ajax the permission error will look like this:\n\u003cimg src=\"https://i.imgur.com/gTD1lJC.png\" alt=\"Enforcer permissions\"\u003e\n\n## Todos\n\n - User specific permissions\n - Groupped controllers. Like the user only has access to billing\n\n## License\n\nLicensed under [The MIT License][mit].\n\n[cakephp]:http://cakephp.org\n[composer]:http://getcomposer.org\n[mit]:http://www.opensource.org/licenses/mit-license.php\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzunnu%2Fenforcer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzunnu%2Fenforcer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzunnu%2Fenforcer/lists"}