final public function execute() {
		if (!is_array($this->controller->accessRules()))
			throw new \Exception('Authentication failed: Method "accessRules" in "' .
				$this->controller->getClass() . '" must return an array');
		foreach ($this->controller->accessRules() as $rule) {
			if (!is_array($rule))
				throw new \Exception('Authentication error: Each element of the array returned by accessRules() must be an array');

			if (!isset($rule[0]))
				throw new \Exception('Authentication error: Each element of the array returned by accessRules() must indicate permission as its first element');

			$permission = $rule[0];
			$rules = (isset($rule[1])) ? $rule[1] : array();

			if (!is_string($permission) || (is_string($permission) && !in_array($permission, array('allow', 'deny'))))
				throw new \Exception('Authentication error: First element of each rules array can only be either "allow" or "deny"');
			if (isset($rules) && !is_array($rules))
				throw new \Exception('Authentication error: The second element of each rules array must return an array');

			if (strtolower($permission) === 'allow') {
				if ($this->checkPermission($rules) === TRUE)
					return true;
			}
			elseif (strtolower($permission) === 'deny') {
				if ($this->checkPermission($rules) === TRUE)
					return false;
			}
		}

		return true;
	}
final public function execute() {
		if (!is_array($this->controller->accessRules()))
			throw new \Exception('Authentication failed: Method "accessRules" in "' .
				$this->controller->getClass() . '" must return an array');
		foreach ($this->controller->accessRules() as $rule) {
			if (!is_array($rule))
				throw new \Exception('Authentication error: Each element of the array returned by accessRules() must be an array');

			if (!isset($rule[0]))
				throw new \Exception('Authentication error: Each element of the array returned by accessRules() must indicate permission as its first element');

			$permission = $rule[0];
			$rules = (isset($rule[1])) ? $rule[1] : array();

			if (!is_string($permission) || (is_string($permission) && !in_array($permission, array('allow', 'deny'))))
				throw new \Exception('Authentication error: First element of each rules array can only be either "allow" or "deny"');
			if (isset($rules) && !is_array($rules))
				throw new \Exception('Authentication error: The second element of each rules array must return an array');

			if (strtolower($permission) === 'allow') {
				if ($this->checkPermission($rules) === TRUE)
					return true;
			}
			elseif (strtolower($permission) === 'deny') {
				if ($this->checkPermission($rules) === TRUE)
					return false;
			}
		}

		return true;
	}
final public function execute ( ) { if ( ! is_array ( $ this -> controller -> accessRules ( ) ) ) throw new \ Exception ( 'Authentication failed: Method "accessRules" in "' . $ this -> controller -> getClass ( ) . '" must return an array' ) ; foreach ( $ this -> controller -> accessRules ( ) as $ rule ) { if ( ! is_array ( $ rule ) ) throw new \ Exception ( 'Authentication error: Each element of the array returned by accessRules() must be an array' ) ; if ( ! isset ( $ rule [ 0 ] ) ) throw new \ Exception ( 'Authentication error: Each element of the array returned by accessRules() must indicate permission as its first element' ) ; $ permission = $ rule [ 0 ] ; $ rules = ( isset ( $ rule [ 1 ] ) ) ? $ rule [ 1 ] : array ( ) ; if ( ! is_string ( $ permission ) || ( is_string ( $ permission ) && ! in_array ( $ permission , array ( 'allow' , 'deny' ) ) ) ) throw new \ Exception ( 'Authentication error: First element of each rules array can only be either "allow" or "deny"' ) ; if ( isset ( $ rules ) && ! is_array ( $ rules ) ) throw new \ Exception ( 'Authentication error: The second element of each rules array must return an array' ) ; if ( strtolower ( $ permission ) === 'allow' ) { if ( $ this -> checkPermission ( $ rules ) === TRUE ) return true ; } elseif ( strtolower ( $ permission ) === 'deny' ) { if ( $ this -> checkPermission ( $ rules ) === TRUE ) return false ; } } return true ; }
Executes the authentication
@return boolean
@throws \Exception
Executes the authentication