Skip to content

Commit

Permalink
feat: Implement brick (#8)
Browse files Browse the repository at this point in the history
Closes #5
  • Loading branch information
Gashmob authored May 18, 2024
2 parents c7b2ef1 + 9b31e57 commit dcc23a4
Show file tree
Hide file tree
Showing 40 changed files with 3,216 additions and 1,512 deletions.
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

0 comments on commit dcc23a4

Please sign in to comment.