Author: bshaffer
Date: 2010-02-13 15:24:29 +0100 (Sat, 13 Feb 2010)
New Revision: 28003

Modified:
   
plugins/csSecurityTaskExtraPlugin/branches/1.3/lib/task/sfAppSecurityTask.class.php
Log:
adds optional "module" argument to only view security for a particular module

Modified: 
plugins/csSecurityTaskExtraPlugin/branches/1.3/lib/task/sfAppSecurityTask.class.php
===================================================================
--- 
plugins/csSecurityTaskExtraPlugin/branches/1.3/lib/task/sfAppSecurityTask.class.php
 2010-02-13 03:32:59 UTC (rev 28002)
+++ 
plugins/csSecurityTaskExtraPlugin/branches/1.3/lib/task/sfAppSecurityTask.class.php
 2010-02-13 14:24:29 UTC (rev 28003)
@@ -6,6 +6,7 @@
   {
     $this->addArguments(array(
           new sfCommandArgument('application', sfCommandArgument::REQUIRED, 
'The application'),
+          new sfCommandArgument('module', sfCommandArgument::OPTIONAL, 'The 
module'),
         ));
         
     $this->addOptions(array(
@@ -31,19 +32,22 @@
     
     foreach ($security as $item) 
     {
-      if (strlen($item['module']) > $maxModule)
+      if (!$arguments['module'] || $arguments['module'] == $item['module']) 
       {
-        $maxModule = strlen($item['module']);
-      }
+        if (strlen($item['module']) > $maxModule)
+        {
+          $maxModule = strlen($item['module']);
+        }
 
-      if (strlen($item['action']) > $maxAction)
-      {
-        $maxAction = strlen($item['action']);
-      }
+        if (strlen($item['action']) > $maxAction)
+        {
+          $maxAction = strlen($item['action']);
+        }
 
-      if (strlen($item['is_secure']) > $maxIsSecure)
-      {
-        $maxIsSecure = strlen($item['is_secure']);
+        if (strlen($item['is_secure']) > $maxIsSecure)
+        {
+          $maxIsSecure = strlen($item['is_secure']);
+        }
       }
     }
     
@@ -54,7 +58,10 @@
     $this->log(sprintf($formatHeader, $this->formatter->format('Module', 
'COMMENT'), $this->formatter->format('Action', 'COMMENT'), 
$this->formatter->format('Is Secure', 'COMMENT'), 
$this->formatter->format('Credentials', 'COMMENT')));
     foreach ($security as $item)
     {
-      $this->log(sprintf($item['is_secure'] ? $formatRow1:$formatRow2, 
$item['module'], $item['action'], 
$item['is_secure']?$this->formatter->format('on', 'INFO') : 
$this->formatter->format('off', 'COMMENT'), $item['credential_string']));
+      if (!$arguments['module'] || $arguments['module'] == $item['module']) 
+      {
+        $this->log(sprintf($item['is_secure'] ? $formatRow1:$formatRow2, 
$item['module'], $item['action'], 
$item['is_secure']?$this->formatter->format('on', 'INFO') : 
$this->formatter->format('off', 'COMMENT'), $item['credential_string']));
+      }
     }
   }
 }
\ No newline at end of file

-- 
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