li3_access\extensions\adapter\security\access\Rules::_init PHP Method

_init() protected method

Initializes default rules to use.
protected _init ( ) : void
return void
    protected function _init()
    {
        parent::_init();
        $this->_rules += array('allowAll' => function () {
            return true;
        }, 'denyAll' => function () {
            return false;
        }, 'allowAnyUser' => function ($user) {
            return $user ? true : false;
        }, 'allowIp' => function ($user, $request, $options) {
            $options += array('ip' => false);
            if (is_string($options['ip']) && strpos($options['ip'], '/') === 0) {
                return (bool) preg_match($options['ip'], $request->env('REMOTE_ADDR'));
            }
            if (is_array($options['ip'])) {
                return in_array($request->env('REMOTE_ADDR'), $options['ip']);
            }
            return $request->env('REMOTE_ADDR') == $options['ip'];
        });
    }