[Solar-svn] Revision 3140

pmjones at solarphp.com pmjones at solarphp.com
Fri May 2 13:24:53 CDT 2008


Solar_Access_Adapter_File

* [FIX] Now honors 'role *' correctly.

* [CHG] When reporting file-not-found, now shows info on both the requested file and the realpath file.

* [CHG] Now allows blank lines, and comment lines starting with #.


Modified: trunk/Solar/Access/Adapter/File.php
===================================================================
--- trunk/Solar/Access/Adapter/File.php	2008-04-30 22:27:23 UTC (rev 3139)
+++ trunk/Solar/Access/Adapter/File.php	2008-05-02 18:24:46 UTC (rev 3140)
@@ -12,7 +12,7 @@
  *     deny handle * * * * 
  *     allow role sysadmin * * * 
  *     allow handle + Solar_App_Bookmarks * * 
- *     deny user boshag Solar_App_Bookmarks edit * 
+ *     deny handle boshag Solar_App_Bookmarks edit * 
  * 
  * @category Solar
  * 
@@ -58,7 +58,10 @@
         if (! Solar_File::exists($file)) {
             throw $this->_exception(
                 'ERR_FILE_NOT_READABLE',
-                array('file' => $file)
+                array(
+                    'file' => $this->_config['file'],
+                    'realpath' => $file,
+                )
             );
         }
         
@@ -73,6 +76,20 @@
         $lines = explode("\n", $src);
         
         foreach ($lines as $line) {
+            
+            $trim = trim($line);
+            
+            // allow blank lines
+            if ($trim == '') {
+                continue;
+            }
+            
+            // allow comment lines
+            $char = substr($trim, 0, 1);
+            if ($char == '#') {
+                continue;
+            }
+            
             // $info keys are ...
             // 0 => "allow" or "deny"
             // 1 => "handle" or "role"
@@ -85,7 +102,7 @@
                 $info[1] == 'handle' && $info[2] == '+' && $handle || // any authenticated user
                 $info[1] == 'handle' && $info[2] == '*' ||            // any user (incl anon)
                 $info[1] == 'role'   && in_array($info[2], $roles) || // direct role match
-                $info[2] == 'role'   && $info[2] == '*') {            // any role (incl anon)
+                $info[1] == 'role'   && $info[2] == '*') {            // any role (incl anon)
                 
                 // keep the line
                 $list[] = array(




More information about the Solar-svn mailing list