| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
* This file is part of the symfony package.
|
|
|
5 |
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
|
6 |
*
|
|
|
7 |
* For the full copyright and license information, please view the LICENSE
|
|
|
8 |
* file that was distributed with this source code.
|
|
|
9 |
*/
|
|
|
10 |
|
|
|
11 |
/**
|
|
|
12 |
* sfSecurityConfigHandler allows you to configure action security.
|
|
|
13 |
*
|
|
|
14 |
* @package symfony
|
|
|
15 |
* @subpackage config
|
|
|
16 |
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
|
17 |
* @version SVN: $Id: sfSecurityConfigHandler.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
|
|
|
18 |
*/
|
|
|
19 |
class sfSecurityConfigHandler extends sfYamlConfigHandler
|
|
|
20 |
{
|
|
|
21 |
/**
|
|
|
22 |
* Executes this configuration handler.
|
|
|
23 |
*
|
|
|
24 |
* @param array $configFiles An array of absolute filesystem path to a configuration file
|
|
|
25 |
*
|
|
|
26 |
* @return string Data to be written to a cache file
|
|
|
27 |
*
|
|
|
28 |
* @throws <b>sfConfigurationException</b> If a requested configuration file does not exist or is not readable
|
|
|
29 |
* @throws <b>sfParseException</b> If a requested configuration file is improperly formatted
|
|
|
30 |
* @throws <b>sfInitializationException</b> If a view.yml key check fails
|
|
|
31 |
*/
|
|
|
32 |
public function execute($configFiles)
|
|
|
33 |
{
|
|
|
34 |
// parse the yaml
|
|
|
35 |
$config = self::getConfiguration($configFiles);
|
|
|
36 |
|
|
|
37 |
// compile data
|
|
|
38 |
$retval = sprintf("<?php\n".
|
|
|
39 |
"// auto-generated by sfSecurityConfigHandler\n".
|
|
|
40 |
"// date: %s\n\$this->security = %s;\n",
|
|
|
41 |
date('Y/m/d H:i:s'), var_export($config, true));
|
|
|
42 |
|
|
|
43 |
return $retval;
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
/**
|
|
|
47 |
* @see sfConfigHandler
|
|
|
48 |
*/
|
|
|
49 |
static public function getConfiguration(array $configFiles)
|
|
|
50 |
{
|
|
|
51 |
$config = self::flattenConfiguration(self::parseYamls($configFiles));
|
|
|
52 |
|
|
|
53 |
// change all of the keys to lowercase
|
|
|
54 |
$config = array_change_key_case($config);
|
|
|
55 |
|
|
|
56 |
return $config;
|
|
|
57 |
}
|
|
|
58 |
}
|