{"id":18929464,"url":"https://github.com/thecodingmachine/security.rightsservice-splash","last_synced_at":"2025-04-15T15:31:02.162Z","repository":{"id":4593969,"uuid":"5736446","full_name":"thecodingmachine/security.rightsservice-splash","owner":"thecodingmachine","description":"This package contains a set of class to bind the Splash MVC framework (\u003e=v4) with the RightsService component. It features: a @RequiresRight annotation to restrict access to logged users only.","archived":false,"fork":false,"pushed_at":"2022-12-06T15:30:47.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"10.0","last_synced_at":"2025-04-11T18:59:50.568Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thecodingmachine.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":"2012-09-09T09:34:04.000Z","updated_at":"2022-12-01T16:59:40.000Z","dependencies_parsed_at":"2023-01-13T13:10:25.060Z","dependency_job_id":null,"html_url":"https://github.com/thecodingmachine/security.rightsservice-splash","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fsecurity.rightsservice-splash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fsecurity.rightsservice-splash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fsecurity.rightsservice-splash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fsecurity.rightsservice-splash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thecodingmachine","download_url":"https://codeload.github.com/thecodingmachine/security.rightsservice-splash/tar.gz/refs/heads/10.0","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249097847,"owners_count":21212362,"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-08T11:32:52.422Z","updated_at":"2025-04-15T15:31:01.905Z","avatar_url":"https://github.com/thecodingmachine.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Integrating the \"rightsservice\" with Splash\n===========================================\n\nThis package is part of the Mouf PHP framework and contains the @Right annotation that integrates the [Splash MVC framework](http://mouf-php.com/packages/mouf/mvc.splash/index.md) with the [RightsService](http://mouf-php.com/packages/mouf/security.rightsservice/README.md).\n\nThis package provides one useful filter:\n\nThe **@Right** annotation\n------------------------------------\n\nThis filter can be used in any action. If you put this annotation, the user will be denied access\nif he does not possess the specified right.\n\n```php\n/**\n * A sample default action that requires to have the \"ACCESS_ADMIN_RIGHT\" right.\n *\n * @URL /admin\n * @Right(\"ACCESS_ADMIN_RIGHT\")\n */\npublic function index() { ... }\n```\n\nThe \u003cb\u003e@Right\u003c/b\u003e annotation requires an instance of `ForbiddenMiddleware` to exist. The name of the instance must be `ForbiddenMiddleware::class`.\nIf your `ForbiddenMiddleware` instance is not named `ForbiddenMiddleware::class` (or if you want to use several ForbiddenMiddleware instances,\nyou can specify the instance of middleware to use in parameter of the annotation:\n\n```php\n/**\n * A sample default action that requires to have the \"ACCESS_ADMIN_RIGHT\" right.\n *\n * @URL /admin\n * @Right(name=\"ACCESS_ADMIN_RIGHT\",instance=\"myForbiddenMiddleware\")\n */\npublic function index() { ... }\n```\n\n\nComposite rights: the **@AndRight** and **@OrRight** annotations\n----------------------------------------------------------------\n\nOccasionally, you might want to check if a user has 2 rights (**and**), or one of two rights (**or**).\n\nTo do this, instead of passing a string to the @Right annotation, you can pass a @AndRight or a @OrRight annotation.\n\nFor instance, to check that a user has both the CAN_DO_THIS and CAN_DO_THAT rights, you should use:\n\n```php\n/**\n * An action that requires to have both the \"CAN_DO_THIS\" and \"CAN_DO_THAT\" right.\n *\n * @URL /admin\n * @Right(@AndRight({@Right(\"CAN_DO_THIS\"), @Right(\"CAN_DO_THAT\")}))\n */\npublic function index() { ... }\n```\n\nIf instead, you want to check that a user has one right amongst many, you would use the @OrRight:\n\n```php\n/**\n * An action that requires to have either the \"CAN_DO_THIS\" or \"CAN_DO_THAT\" right.\n *\n * @URL /admin\n * @Right(@OrRight({@Right(\"CAN_DO_THIS\"), @Right(\"CAN_DO_THAT\")}))\n */\npublic function index() { ... }\n```\n\nYou can also combine @AndRight and @OrRight annotations as long as the top-most annotation is a @Right.\nAlso, if you need to combine complex rights, you should probably start to question your right system and refactor it. @AndRight and @OrRight should really be used sparsely.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodingmachine%2Fsecurity.rightsservice-splash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecodingmachine%2Fsecurity.rightsservice-splash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodingmachine%2Fsecurity.rightsservice-splash/lists"}