Check user permissions on the routes #508 (#516)

* Check user permissions on the routes #508

* Formatting
This commit is contained in:
Nabeel S
2020-01-30 09:23:31 -05:00
committed by GitHub
parent ff913e5304
commit 63b574181a
3 changed files with 133 additions and 74 deletions

View File

@@ -168,8 +168,33 @@ return [
'middleware' => [
'register' => true,
'handling' => 'redirect',
'params' => '/login',
/**
* Handlers for the unauthorized method in the middlewares.
* The name of the handler must be the same as the handling.
*/
'handlers' => [
/**
* Aborts the execution with a 403 code and allows you to provide the response text
*/
'abort' => [
'code' => 403,
'message' => 'User does not have any of the necessary access rights.',
],
/**
* Redirects the user to the given url.
* If you want to flash a key to the session,
* you can do it by setting the key and the content of the message
* If the message content is empty it won't be added to the redirection.
*/
'redirect' => [
'url' => '/',
'message' => [
'key' => 'flash_notification.message',
'content' => 'User does not have any of the necessary access rights.',
],
],
],
'params' => '/login',
],
/*