Strance
(Shahrulhadi)
1
Let say my application has rbac permission admin and enduser. I has create view /site/maintenance.php as maintenance page.
I want to do something like this
if ($app->user->can('enduser')) {
$this->redirect(['/site/maintenance']);
}
How can i make the above code/logic apply to all route without writing it in each controller/action?
So all enduser will be redirected to maintenance page, but admin still can access the website as usual.
jacmoe
(Jacob Moena)
2
Strance
(Shahrulhadi)
3
I has install the extension.
I add this code to the component in config/web.php
'maintenanceMode' => [
'class' => 'brussens\maintenance\MaintenanceMode',
'enabled' => true,
'route' => 'site/maintenance',
],
and add this to bootstrap
maintenanceMode
But when access the website, it display
Not Found (#404).
If i remove route, the page will keep loading until firefox display
The page isn’t redirecting properly.
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
So what is the basic config to make the extension work?
jacmoe
(Jacob Moena)
4
‘site/maintenance’ is not a correct route!
‘maintenance/index’ is - but you can leave that out.
Routes in modules works slightly different than routes in general, but basically: the module name is path-prepended:
module-name/controller/action
See the guide