protected function _init() {
		parent::_init();
		$this->_rules += [
			'allowAll' => [
				'rule' => function() {
					return true;
				}
			],
			'denyAll' => [
				'rule' => function() {
					return false;
				}
			],
			'allowAnyUser' => [
				'message' => 'You must be logged in.',
				'rule' => function($user) {
					return $user ? true : false;
				}
			],
			'allowIp' => [
				'message' => 'Your IP is not allowed to access this area.',
				'rule' => function($user, $request, $options) {
					$options += ['ip' => false];
					if (is_string($options['ip']) && strpos($options['ip'], '/') === 0) {
						return (boolean) 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'];
				}
			]
		];
	}
protected function _init() {
		parent::_init();
		$this->_rules += [
			'allowAll' => [
				'rule' => function() {
					return true;
				}
			],
			'denyAll' => [
				'rule' => function() {
					return false;
				}
			],
			'allowAnyUser' => [
				'message' => 'You must be logged in.',
				'rule' => function($user) {
					return $user ? true : false;
				}
			],
			'allowIp' => [
				'message' => 'Your IP is not allowed to access this area.',
				'rule' => function($user, $request, $options) {
					$options += ['ip' => false];
					if (is_string($options['ip']) && strpos($options['ip'], '/') === 0) {
						return (boolean) 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'];
				}
			]
		];
	}
protected function _init ( ) { parent :: _init ( ) ; $ this -> _rules += [ 'allowAll' => [ 'rule' => function ( ) { return true ; } ] , 'denyAll' => [ 'rule' => function ( ) { return false ; } ] , 'allowAnyUser' => [ 'message' => 'You must be logged in.' , 'rule' => function ( $ user ) { return $ user ? true : false ; } ] , 'allowIp' => [ 'message' => 'Your IP is not allowed to access this area.' , 'rule' => function ( $ user , $ request , $ options ) { $ options += [ 'ip' => false ] ; if ( is_string ( $ options [ 'ip' ] ) && strpos ( $ options [ 'ip' ] , '/' ) === 0 ) { return ( boolean ) 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' ] ; } ] ] ; }
Initializes default rules to use.
Initializes default rules to use .