From 5dfde34127f4c15f1499f4b9f38b87263d5dea77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Wed, 15 Apr 2015 10:20:14 +0200 Subject: [PATCH] Can access WebDAV when redmine is located under sub-URI #377 --- README.md | 33 ++++++----------------------- config/routes.rb | 2 +- lib/redmine_dmsf/webdav/no_parse.rb | 5 +++-- 3 files changed, 10 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 358f8484..550dc66f 100644 --- a/README.md +++ b/README.md @@ -144,33 +144,12 @@ Before installing ensure that the Redmine instance is stopped. 1. In case of upgrade BACKUP YOUR DATABASE first 2. Put redmine_dmsf plugin directory into plugins -3. If you install Redmine in a sub-uri, it's necessary to modify two hard-coded paths in order to webdav is working: - - a) /config/routes.rb - - ```ruby - mount DAV4Rack::Handler.new( - -- :root_uri_path => '/dmsf/webdav', - ++ :root_uri_path => '/sub-uri/dmsf/webdav', - :resource_class => RedmineDmsf::Webdav::ResourceProxy, - :controller_class => RedmineDmsf::Webdav::Controller - ), :at => "/dmsf/webdav" - ``` - - b) lib/redmine_dmsf/webdav/no_parse.rb - - ```ruby - Rails.configuration.middleware.insert_before(ActionDispatch::ParamsParser, - -- RedmineDmsf::NoParse, :urls => ['/dmsf/webdav']) - ++ RedmineDmsf::NoParse, :urls => ['/sub-uri/dmsf/webdav']) - ``` - -4. Initialize/Update database: `rake redmine:plugins:migrate RAILS_ENV="production"` -5. The access rights must be set for web server, example: `chown -R www-data:www-data plugins/redmine_dmsf` -6. Restart web server -7. You should configure plugin via Redmine interface: Administration -> Plugins -> DMSF -> Configure -8. Assign DMSF permissions to appropriate roles -9. There are two rake tasks: +3. Initialize/Update database: `rake redmine:plugins:migrate RAILS_ENV="production"` +4. The access rights must be set for web server, example: `chown -R www-data:www-data plugins/redmine_dmsf` +5. Restart web server +6. You should configure plugin via Redmine interface: Administration -> Plugins -> DMSF -> Configure +7. Assign DMSF permissions to appropriate roles +8. There are two rake tasks: a) To convert documents from the standard Redmine document module diff --git a/config/routes.rb b/config/routes.rb index 9569f325..1b827724 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -111,7 +111,7 @@ RedmineApp::Application.routes.draw do # DAV4Rack implementation of Webdav [note: if changing path you'll need to update lib/redmine_dmsf/webdav/no_parse.rb also] # /dmsf/webdav mount DAV4Rack::Handler.new( - :root_uri_path => "/dmsf/webdav", + :root_uri_path => "#{Redmine::Utils::relative_url_root}/dmsf/webdav", :resource_class => RedmineDmsf::Webdav::ResourceProxy, :controller_class => RedmineDmsf::Webdav::Controller ), :at => "/dmsf/webdav" diff --git a/lib/redmine_dmsf/webdav/no_parse.rb b/lib/redmine_dmsf/webdav/no_parse.rb index ee8625bc..bef4080c 100644 --- a/lib/redmine_dmsf/webdav/no_parse.rb +++ b/lib/redmine_dmsf/webdav/no_parse.rb @@ -46,5 +46,6 @@ end # This should probably be configurable somehow or better have the module hunt for the correct pathing # automatically without the need to add a "/dmsf/webdav" configuration to it, as if the route is changed # the functonality of this patch will effectively break. -Rails.configuration.middleware.insert_before(ActionDispatch::ParamsParser, - RedmineDmsf::NoParse, :urls => ['/dmsf/webdav']) \ No newline at end of file +Rails.configuration.middleware.insert_before( + ActionDispatch::ParamsParser, + RedmineDmsf::NoParse, :urls => ["#{Redmine::Utils::relative_url_root}/dmsf/webdav"]) \ No newline at end of file