diff --git a/Gemfile b/Gemfile index aec86684..463fc7ed 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,7 @@ source "https://rubygems.org" gem "zip" +gem "dav4rack" #Allows --without=xapian group :xapian do diff --git a/config/routes.rb b/config/routes.rb index 8c4d7739..df77b46a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -88,6 +88,9 @@ RedmineApp::Application.routes.draw do post '/dmsf/folders/:id/copy/to', :controller => 'dmsf_folders_copy', :action => 'copy_to' get '/dmsf/folders/:id/copy', :controller => 'dmsf_folders_copy', :action => 'new' - - + mount DAV4Rack::Handler.new( +# :root => Rails.root.to_s, + :root_uri_path => "/dmsf/webdav", + :resource_class => RedmineDmsf::Webdav::ResourceFactory + ), :at => "/dmsf/webdav" end diff --git a/lib/redmine_dmsf.rb b/lib/redmine_dmsf.rb index a06e9306..99a6fcb5 100644 --- a/lib/redmine_dmsf.rb +++ b/lib/redmine_dmsf.rb @@ -1,6 +1,7 @@ require 'redmine_dmsf/patches/custom_fields_helper' require 'redmine_dmsf/patches/acts_as_customizable' require 'redmine_dmsf/patches/project_patch' +require 'redmine_dmsf/webdav' module RedmineDmsf end diff --git a/lib/redmine_dmsf/webdav.rb b/lib/redmine_dmsf/webdav.rb new file mode 100644 index 00000000..ee012cfa --- /dev/null +++ b/lib/redmine_dmsf/webdav.rb @@ -0,0 +1 @@ +require 'redmine_dmsf/webdav/resource_factory' diff --git a/lib/redmine_dmsf/webdav/resource_factory.rb b/lib/redmine_dmsf/webdav/resource_factory.rb new file mode 100644 index 00000000..9872b449 --- /dev/null +++ b/lib/redmine_dmsf/webdav/resource_factory.rb @@ -0,0 +1,17 @@ +module RedmineDmsf + module Webdav + class ResourceFactory < DAV4Rack::Resource + + def initialize(public_path, path, request, response, options) + super(public_path, path, request, response, options) + if (path == "") + end + end + + def authenticate(username, password) + User.try_to_login(username, password) ? true : false + end + + end + end +end