Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implement brick #8

Merged
merged 5 commits into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
.vscode
vendor
vendor
cache
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace Archict\Firewall;

interface UserProvider
{
public function getCurrentUser(ServerRequestInterface $request): User;
public function getCurrentUser(ServerRequestInterface $request): UserWithRoles;
}
```

Expand All @@ -50,7 +50,7 @@ The class you pass in the config must implement this interface.

namespace Archict\Firewall;

interface User
interface UserWithRoles
{
/**
* @return string[]
Expand All @@ -74,7 +74,7 @@ roles), or implement your own checker.
If you choose to use firewall checker, then you must provide these 2 tags:

- `provider` ➡ One of the previously defined provider
- `roles` ➡ An array of string. User must have one these roles to access resource
- `roles` ➡ An array of string. User must have one of these roles to access resource

Then you can define the behavior with one these rules (only one):

Expand Down
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
},
"require": {
"php": ">= 8.2",
"archict/brick": "^0"
"archict/brick": "^0",
"psr/http-message": "^2.0",
"archict/router": "^0"
},
"autoload-dev": {
"psr-4": {
"Archict\\Firewall\\": "tests/unit"
"Archict\\Firewall\\": ["tests/unit", "tests/lib"]
}
},
"require-dev": {
Expand All @@ -23,7 +25,8 @@
"phpunit/phpunit": "^10",
"squizlabs/php_codesniffer": "^3.9",
"slevomat/coding-standard": "^8.15",
"archict/core": "^0"
"archict/core": "^0",
"guzzlehttp/psr7": "^2.6"
},
"scripts": {
"unit-test": "phpunit --testsuite unit",
Expand Down
Loading