HOW TO block access to controller from specific IP?

Discuss everything related to ApPHP Durecty CMF. All versions. Any questions related to the Directy CMF developing or using should be posted to this forum.

Moderators: alexandrleonenko, alexmst

administrator
Site Admin
Site Admin
Posts: 6169
Joined: Jan 7th, '09, 23:18
Contact:

HOW TO block access to controller from specific IP?

Postby administrator » Sep 1st, '18, 12:12

There is a new feature available in Framework v.1.1.5 or above.
You may block access to any controller form specific IP address.

To do this follow these instructions:

1. Define method _accessRules() in your controller.
2. Specify allow and deny options for one or group of actions and IP addresses as following:

Code: Select all

protected function _accessRules()
{
   return array(
      array('allow',
         'actions' => array('*'),
         'ips' => array('127.0.0.1')
      ),
      array('deny',
         'actions' => array('index','view', 'create', 'update', 'manage'),
         'ips' => array('*')
      ),
   );
}

Return to “ApPHP Directy CMF {developers/users}”