D
D
Dmitry Petrik2014-08-25 12:57:28
Yii
Dmitry Petrik, 2014-08-25 12:57:28

Yii. IP filter. How to disable authorization?

It is necessary to allow access to certain pages only from certain IPs. Wrote this code:

public function filters()
        {
            return array('accessControl'); // perform access control for CRUD operations
        }
        public function accessRules()
        {
            return array(
                array('allow',
                    'actions'=>array('manage'),
                    'users'=>array('?'),
                    'ips'=>array('139.45.125.33'),
                ),
                 array('deny',
                    'actions'=>array('manage'),
                    'users'=>array('*'),
                    'ips'=>array('*'),
                ),
            );
        }

And it seems to be working. But when I go to a forbidden page, at the beginning I get an authorization request (and there is no registration on the site). Only after authorization the filter on IP works. How to disable authorization? To immediately work the IP filter

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Max, 2014-08-25
@Flexo

Make your own filter by inheriting CFilter and implement the preFilter() method in it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question