/**
  * Returns a config based on the specified file.
  *
  * @param MOXMAN_Vfs_IFile $file File to get the config for.
  * @return MOXMAN_Util_Config Config for the specified file.
  */
 public function getConfig(MOXMAN_Vfs_IFile $file)
 {
     $config = clone $this->config;
     $path = $file->isFile() ? $file->getParent() : $file->getPath();
     $root = $this->fileSystem->getRootPath();
     $mcAccessFile = $this->config->get("filesystem.local.access_file_name", "mc_access");
     $user = MOXMAN::getUser();
     $configFiles = array();
     $targetConfigPath = $path . '/' . $mcAccessFile;
     // Collect config files
     while ($path && strlen($path) >= strlen($root)) {
         if (file_exists($path . '/' . $mcAccessFile)) {
             $configFiles[] = $path . '/' . $mcAccessFile;
         }
         $path = MOXMAN_Util_PathUtils::getParent($path);
     }
     // Extend current config with the config files
     for ($i = count($configFiles) - 1; $i >= 0; $i--) {
         // Parse mc_access file
         $iniParser = new MOXMAN_Util_IniParser();
         $iniParser->load($configFiles[$i]);
         // Loop and extend it
         $items = $iniParser->getItems();
         foreach ($items as $key => $value) {
             // Group specific config
             if (is_array($value)) {
                 $targetGroups = explode(',', $key);
                 foreach ($targetGroups as $targetGroup) {
                     if ($user->isMemberOf($targetGroup)) {
                         foreach ($value as $key2 => $value2) {
                             if (strpos($key2, '_') === 0) {
                                 if ($targetConfigPath == $configFiles[$i]) {
                                     $key2 = substr($key2, 1);
                                 } else {
                                     continue;
                                 }
                             }
                             $config->put($key2, $value2);
                         }
                     }
                 }
             } else {
                 if (strpos($key, '_') === 0) {
                     if ($targetConfigPath == $configFiles[$i]) {
                         $key = substr($key, 1);
                     } else {
                         continue;
                     }
                 }
                 $config->put($key, $value);
             }
         }
     }
     return $config;
 }
 /**
  * Returns the parent files absolute path or an empty string if there is no parent.
  *
  * @return String parent files absolute path.
  */
 public function getParent()
 {
     $path = MOXMAN_Util_PathUtils::getParent($this->getPath());
     // If path is out side the file systems root path
     if (!MOXMAN_Util_PathUtils::isChildOf($path, $this->fileSystem->getRootPath())) {
         return "";
     }
     return $path;
 }