Changeset 3140

Show
Ignore:
Timestamp:
05/02/08 13:24:46 (2 months ago)
Author:
pmjones
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Solar/Access/Adapter/File.php

    r2926 r3140  
    1313 *     allow role sysadmin * * *  
    1414 *     allow handle + Solar_App_Bookmarks * *  
    15  *     deny user boshag Solar_App_Bookmarks edit *  
     15 *     deny handle boshag Solar_App_Bookmarks edit *  
    1616 *  
    1717 * @category Solar 
     
    5959            throw $this->_exception( 
    6060                'ERR_FILE_NOT_READABLE', 
    61                 array('file' => $file) 
     61                array( 
     62                    'file' => $this->_config['file'], 
     63                    'realpath' => $file, 
     64                ) 
    6265            ); 
    6366        } 
     
    7477         
    7578        foreach ($lines as $line) { 
     79             
     80            $trim = trim($line); 
     81             
     82            // allow blank lines 
     83            if ($trim == '') { 
     84                continue; 
     85            } 
     86             
     87            // allow comment lines 
     88            $char = substr($trim, 0, 1); 
     89            if ($char == '#') { 
     90                continue; 
     91            } 
     92             
    7693            // $info keys are ... 
    7794            // 0 => "allow" or "deny" 
     
    86103                $info[1] == 'handle' && $info[2] == '*' ||            // any user (incl anon) 
    87104                $info[1] == 'role'   && in_array($info[2], $roles) || // direct role match 
    88                 $info[2] == 'role'   && $info[2] == '*') {            // any role (incl anon) 
     105                $info[1] == 'role'   && $info[2] == '*') {            // any role (incl anon) 
    89106                 
    90107                // keep the line