d10dec9bf3
* 2.3: fixed Client when using the terminable event Fix problem with Windows file links (backslash in JavaScript string) [Security] fixed wrong phpdoc [DependencyInjection] Prevented inlining of lazy loaded private service definitions. [Routing] removed extra argument [HttpFoundation] Header `HTTP_X_FORWARDED_PROTO` can contain various values Some proxies use `ssl` instead of `https`, as well as Lighttpd mod_proxy allows value chaining (`https, http`, where `https` is always first when request is encrypted). Added doc comments Conflicts: src/Symfony/Component/Routing/Router.php src/Symfony/Component/Security/Http/Firewall.php
53 lines
1.5 KiB
PHP
53 lines
1.5 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the Symfony package.
|
|
*
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Symfony\Component\Security\Http;
|
|
|
|
use Symfony\Component\HttpFoundation\RequestMatcherInterface;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
|
/**
|
|
* AccessMap allows configuration of different access control rules for
|
|
* specific parts of the website.
|
|
*
|
|
* @author Fabien Potencier <fabien@symfony.com>
|
|
*/
|
|
class AccessMap implements AccessMapInterface
|
|
{
|
|
private $map = array();
|
|
|
|
/**
|
|
* Constructor.
|
|
*
|
|
* @param RequestMatcherInterface $requestMatcher A RequestMatcherInterface instance
|
|
* @param array $attributes An array of attributes to pass to the access decision manager (like roles)
|
|
* @param string|null $channel The channel to enforce (http, https, or null)
|
|
*/
|
|
public function add(RequestMatcherInterface $requestMatcher, array $attributes = array(), $channel = null)
|
|
{
|
|
$this->map[] = array($requestMatcher, $attributes, $channel);
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public function getPatterns(Request $request)
|
|
{
|
|
foreach ($this->map as $elements) {
|
|
if (null === $elements[0] || $elements[0]->matches($request)) {
|
|
return array($elements[1], $elements[2]);
|
|
}
|
|
}
|
|
|
|
return array(null, null);
|
|
}
|
|
}
|