I came across the following error, where it says that the user is not allowed to access the page:
Error 403
You are not allowed to access this page.
Can someone please help me?
I came across the following error, where it says that the user is not allowed to access the page:
Error 403
You are not allowed to access this page.
Can someone please help me?
If the page you want to access is like this:
localhost/app/index.php?r=usuario/admin
,
then you should get the file /app/protected/controllers/UsuarioController.php
and within this search the function accessRules()
and modify and / or increase the following
return array(
...,
array(
'allow', // aqui estas permitindo algo
'actions' => array('admin','admin2'), // aqui dizes que algo (accion) queres permitir podes colocar cuantas queiras
'users' => array('admin'), // aqui dizes quem tem permisao para ver esta "pagina"
),
array('deny',
'users' => array('*'),
),
...,
);
On this page you will find more information about accessRules
.
This error is certainly caused by the IP filtering engine that Gii uses to protect the system against intruders, by default only access to localhost is allowed, to remote users that access is denied.
To work around this, you need to edit the main configuration file in the modules section for Gii , and edit the array , ipFilters
, to include your IP.
// protected/config/main.php
return array(
...
'modules' => array(
'gii' => array(
'class' => 'system.gii.GiiModule',
'password' => 'Senha',
'ipFilters' => array('127.0.0.1', '192.168.1.7'), // Adicione o seu IP aqui
),
...
The ipFilters
property can include as many items as you want, they can be IP addresses or wildcards, such as 192.168.1.*
. If you want to allow all addresses to access that page, you can change the property to false:
'ipFilters' => false
But remember, as stated in the documentation :
If you want to allow all IPs to access gii, you can set this property to be false ( DO NOT DO this if you do not know the consequence! ) The default value is array ('127 .0.0.1 ',' :: 1 '), which means GiiModule can only be accessed from localhost.