Sha256: 1b87f5f5df0417b7dc23a6dfcbe7877d2ca17f1564e5a43b4ce08d82bff1e423

Contents?: true

Size: 1.25 KB

Versions: 4

Compression:

Stored size: 1.25 KB

Contents

class ElfinderController < ApplicationController

  skip_before_filter :verify_authenticity_token, :only => ['connector']
  def connector
    h, r = ElFinder::Connector.new(
      :root => File.join(Rails.public_path, 'system', 'elfinder'),
      :url => '/system/elfinder',
      :perms => {
        #/^(Welcome|README)$/ => {:read => true, :write => false, :rm => false},
        '.' => {:read => true, :write => true, :rm => true}, # '.' is the proper way to specify the home/root directory.
        #/^test$/ => {:read => true, :write => true, :rm => false},
        #'logo.png' => {:read => true},
        #/\.png$/ => {:read => false} # This will cause 'logo.png' to be unreadable.
        # Permissions err on the safe side. Once false, always false.
      },
      :extractors => {
        'application/zip' => ['unzip', '-qq', '-o'], # Each argument will be shellescaped (also true for archivers)
        'application/x-gzip' => ['tar', '-xzf'],
      },
      :archivers => {
        'application/zip' => ['.zip', 'zip', '-qr9'], # Note first argument is archive extension
        'application/x-gzip' => ['.tgz', 'tar', '-czf'],
      }
    ).run(params)
    headers.merge!(h)
    render (r.empty? ? {:nothing => true} : {:text => r.to_json}), :layout => false
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
elrte-0.0.5 app/controllers/elfinder_controller.rb
elrte-0.0.4 app/controllers/elfinder_controller.rb
elrte-0.0.3 app/controllers/elfinder_controller.rb
elrte-0.0.1 app/controllers/elfinder_controller.rb