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