Author: bshaffer
Date: 2010-02-12 17:29:35 +0100 (Fri, 12 Feb 2010)
New Revision: 27955

Modified:
   
plugins/csSecurityTaskExtraPlugin/branches/1.3/lib/task/sfAppSecurityTask.class.php
   
plugins/csSecurityTaskExtraPlugin/branches/1.3/lib/task/sfBaseSecurityTaskExtraTask.class.php
Log:
better implementation - actually pulls from cached security.yml file - takes 
into account security handler

Modified: 
plugins/csSecurityTaskExtraPlugin/branches/1.3/lib/task/sfAppSecurityTask.class.php
===================================================================
--- 
plugins/csSecurityTaskExtraPlugin/branches/1.3/lib/task/sfAppSecurityTask.class.php
 2010-02-12 16:12:44 UTC (rev 27954)
+++ 
plugins/csSecurityTaskExtraPlugin/branches/1.3/lib/task/sfAppSecurityTask.class.php
 2010-02-12 16:29:35 UTC (rev 27955)
@@ -26,6 +26,7 @@
     $maxAction = 6;
     $maxIsSecure = 9;
     
+    $this->bootstrapSymfony($arguments['application'], $options['env'], true);
     $security = $this->getSecurityArray();
     
     foreach ($security as $item) 

Modified: 
plugins/csSecurityTaskExtraPlugin/branches/1.3/lib/task/sfBaseSecurityTaskExtraTask.class.php
===================================================================
--- 
plugins/csSecurityTaskExtraPlugin/branches/1.3/lib/task/sfBaseSecurityTaskExtraTask.class.php
       2010-02-12 16:12:44 UTC (rev 27954)
+++ 
plugins/csSecurityTaskExtraPlugin/branches/1.3/lib/task/sfBaseSecurityTaskExtraTask.class.php
       2010-02-12 16:29:35 UTC (rev 27955)
@@ -3,17 +3,37 @@
 abstract class sfBaseSecurityTaskExtraTask extends sfBaseTask
 { 
   protected $labelFormat = array('fg' => 'white', 'bold' => true);
+  
+  protected function bootstrapSymfony($app, $env, $debug = true)
+  {
+    $configuration = ProjectConfiguration::getApplicationConfiguration($app, 
$env, $debug);
+
+    sfContext::createInstance($configuration);
+  }
+  
+  protected function loadApplicationSecurity()
+  {
+    $path = sfConfig::get('sf_app_config_dir').'/security.yml';
+    include(sfContext::getInstance()->getConfigCache()->checkConfig($path));
+    return $this->security;
+  }
+
+  protected function loadModuleSecurity($module)
+  {
+    $path = 
sfConfig::get('sf_app_module_dir').'/'.$module.'/config/security.yml';
+    include(sfContext::getInstance()->getConfigCache()->checkConfig($path));
+    return $this->security;
+  }
+  
   public function getSecurityArray($options = array())
   {
-    $appSecurityPath = sfConfig::get('sf_app_config_dir').'/security.yml';
-    
-    $appSecurity = file_exists($appSecurityPath) ? 
sfYaml::load($appSecurityPath) : array();
+    $appSecurity = $this->loadApplicationSecurity();
 
-    $this->appSecurity = isset($appSecurity['default']) ? 
$appSecurity['default'] : array('default' => array('is_secure' => false));
+    $this->appSecurity = isset($appSecurity['all']) ? $appSecurity['all'] : 
array('all' => array('is_secure' => false));
 
     $this->appSecurity = array(
                             'module'            => 'global',
-                            'action'            => 'default',
+                            'action'            => 'all',
                             'is_secure'         => 
$this->appSecurity['is_secure'],
                             'credentials'       => 
isset($this->appSecurity['credentials']) ? $this->appSecurity['credentials'] : 
array(),
                             'credential_string' => 
isset($this->appSecurity['credentials']) ? 
$this->formatCredentials($this->appSecurity['credentials']) : 
$this->formatter->format('none', 'COMMENT'));
@@ -26,7 +46,7 @@
     foreach ($files as $policy_file) {
       ereg("^".sfConfig::get('sf_app_dir')."/modules/([^/]+)/", $policy_file, 
$matches);
 
-      $policy = sfYaml::load($policy_file);
+      $policy = $this->loadModuleSecurity($matches[1]);
       
       foreach ($policy as $action => $actionOptions) 
       {

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to