{"id":22477571,"url":"https://github.com/maplephp/roles","last_synced_at":"2025-08-10T07:07:47.743Z","repository":{"id":209873550,"uuid":"719604788","full_name":"MaplePHP/Roles","owner":"MaplePHP","description":"Create and manage user roles","archived":false,"fork":false,"pushed_at":"2023-12-05T21:23:54.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-04T16:17:28.448Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MaplePHP.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":"2023-11-16T14:18:46.000Z","updated_at":"2023-11-29T17:47:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"238d710e-3bc3-4d17-b196-89f13f3af66c","html_url":"https://github.com/MaplePHP/Roles","commit_stats":null,"previous_names":["maplephp/roles"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/MaplePHP/Roles","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaplePHP%2FRoles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaplePHP%2FRoles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaplePHP%2FRoles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaplePHP%2FRoles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MaplePHP","download_url":"https://codeload.github.com/MaplePHP/Roles/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaplePHP%2FRoles/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269688691,"owners_count":24459504,"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","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-12-06T14:11:34.418Z","updated_at":"2025-08-10T07:07:47.717Z","avatar_url":"https://github.com/MaplePHP.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Roles\nCreate and manage user roles\n\n\n### Initiate\nInitiate and set the current user role. This will usally come from the database.\n```php\nuse MaplePHP\\Roles\\Role;\n\n$loggedInUserRole = 3;\n$roles = new Role($loggedInUserRole);\n```\n\n### Specify the roles\nPropagate the roles with permissions for specific page\n```php\n$roles-\u003eset(Role::getRole(\"ADMIN\"), \"r=1\u0026i=1\u0026u=1\u0026d=1\");\n$roles-\u003eset(Role::getRole(\"EDITOR\"), \"read=1\u0026insert=1\u0026update=1\u0026delete=1\");\n$roles-\u003eset([\n    Role::getRole(\"AUTHOR\") =\u003e \"r=1\u0026i=1\u0026u=1\u0026d=0\",\n    Role::getRole(\"MEMBER\") =\u003e \"r=1\u0026i=0\u0026u=0\u0026d=0\",\n]);\n```\n\n### Validate permissions \nNow you only need to validate the permissions with in every specific controller method\n```php\nvar_dump($roles-\u003ehasRead(), $roles-\u003ehasInsert(), $roles-\u003ehasUpdate(), $roles-\u003ehasDelete());\n// Result: bool(true) bool(true) bool(true) bool(false)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaplephp%2Froles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaplephp%2Froles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaplephp%2Froles/lists"}