Skip to content

Commit 6d5683a

Browse files
datamwebkenjis
andauthored
docs: apply suggestions from code review
Co-authored-by: kenjis <kenji.uui@gmail.com>
1 parent 0ba8263 commit 6d5683a

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

UPGRADING.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,17 @@ following steps will be done.
2929

3030
The following items have been added. Copy the properties in **src/Config/Auth.php**.
3131

32-
- `$permission_denied` and `$group_denied` are added to `Config\Auth::$redirects`.
32+
- `permission_denied` and `group_denied` are added to `Config\Auth::$redirects`.
3333
- `permissionDeniedRedirect()` and `groupDeniedRedirect()` are added.
3434

3535
#### Fix Custom Filter If extends `AbstractAuthFilter`
36-
If you have written a custom filter that extends `AbstractAuthFilter`. Now you need to add and implement method `redirectToDeniedUrl()` to your custom filter.
36+
37+
If you have written a custom filter that extends `AbstractAuthFilter`, now you need to add and implement the `redirectToDeniedUrl()` method to your custom filter.
3738
The following example is related to the above explanation for **group** filter.
39+
3840
```php
3941
/**
40-
* If there is no necessary access to the group,
41-
* it will redirect the user to the set URL with an error message.
42+
* If the user does not belong to the group, redirect to the configured URL with an error message.
4243
*/
4344
protected function redirectToDeniedUrl(): RedirectResponse
4445
{

src/Filters/AbstractAuthFilter.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,14 @@ public function after(RequestInterface $request, ResponseInterface $response, $a
5555
// Nothing required
5656
}
5757

58+
/**
59+
* Ensures the user is logged in and has one or more
60+
* of the permissions as specified in the filter.
61+
*/
5862
abstract protected function isAuthorized(array $arguments): bool;
5963

64+
/**
65+
* Returns redirect response when the user does not have access authorizations.
66+
*/
6067
abstract protected function redirectToDeniedUrl(): RedirectResponse;
6168
}

src/Filters/GroupFilter.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ protected function isAuthorized(array $arguments): bool
2121
}
2222

2323
/**
24-
* If there is no necessary access to the group,
25-
* it will redirect the user to the set URL with an error message.
24+
* If the user does not belong to the group, redirect to the configured URL with an error message.
2625
*/
2726
protected function redirectToDeniedUrl(): RedirectResponse
2827
{

src/Filters/PermissionFilter.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ protected function isAuthorized(array $arguments): bool
2727
}
2828

2929
/**
30-
* If there is no necessary access to the permission,
31-
* it will redirect the user to the set URL with an error message.
30+
* If the user does not have the permission, redirect to the configured URL with an error message.
3231
*/
3332
protected function redirectToDeniedUrl(): RedirectResponse
3433
{

0 commit comments

Comments
 (0)