1
I came across the following error, where in the same says that the user is not allowed to access the page:
Error 403
You are not allowed to access this page.
Please, someone can help me?
1
I came across the following error, where in the same says that the user is not allowed to access the page:
Error 403
You are not allowed to access this page.
Please, someone can help me?
0
This error is certainly caused by IP filtering mechanism that Gii use to protect the system against intruders, by default only access is allowed in localhost, to remote users(which apparently includes you) access is denied.
To get around this, you need to edit the main configuration file in the module section to 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 estate ipFilters
can include as many items as you want, can be IP addresses or wildcards, such as 192.168.1.*
. If you want to allow all addresses to access such page, you can change to fake the property:
'ipFilters' => false
But remember, as said in documentation:
If you want to allow all Ips to access gii, you can set this property to be false (DON’T DO THIS IF YOU DON’T KNOW THE CONSEQUENCE!) The default value is array ('127 .0.0.1',' :: 1 '), which means Giimodule can only be accessed on the localhost.
0
If the page you want to access is like this:
localhost/app/index.php?r=usuario/admin
,
then you must get the file /app/protected/controllers/UsuarioController.php
and within it seek 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
.
Browser other questions tagged php yii
You are not signed in. Login or sign up in order to post.
beauty @vandro Thanks so much for the help :)
– user3677610
Guys was my fault because I did not know that I had to log in to run the app... thanks to all
– user3677610