Conversation
7b3c6b8 to
1cc3cbb
Compare
|
|
||
| private function matchesStrategy(array $strategy, AuditContext $ctx): bool | ||
| { | ||
| if (isset($strategy['route']) && !$this->routeMatches($strategy['route'], $ctx->route)) { |
There was a problem hiding this comment.
@andrestejerina97 here we are missing to check the HTTP verb too
a route is compound of 2 attributes
- HTTP verb
- URI
|
|
||
| private function routeMatches(string $pattern, string $actual_route): bool | ||
| { | ||
| $normalized_pattern = preg_replace('/\{[a-zA-Z_]+\}/', '\d+', $pattern); |
There was a problem hiding this comment.
@andrestejerina97 we dont need this lets just add the rawRoute ( without the bindings at AuditContext)
here
summit-api/app/Audit/AuditEventListener.php
Line 111 in ee9422d
like this
rawRoute: Route::getRoutes()->match($req);
and then it just a simple string comparison
smarcet
left a comment
There was a problem hiding this comment.
@andrestejerina97 please review comments
app/Audit/AuditEventListener.php
Outdated
| $req = request(); | ||
|
|
||
|
|
||
| $route = Route::getRoutes()->match(request()); |
There was a problem hiding this comment.
use $req here we are already getting the ref
app/Audit/AuditEventListener.php
Outdated
|
|
||
| $route = Route::getRoutes()->match(request()); | ||
| $method = isset($route->methods[0]) ? $route->methods[0] : null; | ||
| $rawRoute = $method."|".$route->uri; |
There was a problem hiding this comment.
use a constant here to communicate the intention
|
|
||
| private function matchesStrategy(array $strategy, AuditContext $ctx): bool | ||
| { | ||
| if (isset($strategy['route']) && !$this->routeMatches($strategy['route'], $ctx->route)) { |
There was a problem hiding this comment.
u need to user $ctx->rawRoute not $ctx->route
smarcet
left a comment
There was a problem hiding this comment.
@andrestejerina97 @martinquiroga-exo pleare review comments
ceb8212 to
88ad555
Compare
…context to the formatters
88ad555 to
e6043e6
Compare
config/audit_log.php
Outdated
| 'formatter' => \App\Audit\ConcreteFormatters\PresentationFormatters\PresentationEventApiAuditLogFormatter::class, | ||
| ], | ||
| [ | ||
| 'route' => 'PUT|api/v1/summits/{id}/events', |
There was a problem hiding this comment.
this is missing param {event_id}
route is api/v1/summits/{id}/events/{event_id}
* feat: add news formatter for entitys related to Presentation for speakers * feat: add a formatter for entities related to speaker presentations * chore: replace the otlp interface with abstractFactory. Add the user context to the formatters * chore: refactor getUserInfo to AbstractAuditLog * chore: refactor strategy for get Formatters * chore: change path to actual routes * fix: change path to actual routes * fix: OpenAPI doc * fix: add missing param --------- Co-authored-by: Matias Perrone <github@matiasperrone.com>
* feat: add news formatter for entitys related to Presentation for speakers * feat: add a formatter for entities related to speaker presentations * chore: replace the otlp interface with abstractFactory. Add the user context to the formatters * chore: refactor getUserInfo to AbstractAuditLog * chore: refactor strategy for get Formatters * chore: change path to actual routes * fix: change path to actual routes * fix: OpenAPI doc * fix: add missing param --------- Co-authored-by: Matias Perrone <github@matiasperrone.com>
This reverts commit 7e817d7.
No description provided.