From c3bce80b48305a54c3596cd8abc272f6e53100dc Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Thu, 24 Mar 2016 06:55:02 +0100 Subject: [PATCH] Errors while reconecting to the DMSf WebDAV root --- lib/redmine_dmsf/webdav/resource_proxy.rb | 37 +++++++++-------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/lib/redmine_dmsf/webdav/resource_proxy.rb b/lib/redmine_dmsf/webdav/resource_proxy.rb index fa1f446f..1cd5998b 100644 --- a/lib/redmine_dmsf/webdav/resource_proxy.rb +++ b/lib/redmine_dmsf/webdav/resource_proxy.rb @@ -43,20 +43,13 @@ module RedmineDmsf end @resource_c.accessor = self if @resource_c end - + def authenticate(username, password) - # Bugfix: Current DAV4Rack (including production) authenticate against ALL requests - # Microsoft Web Client will not attempt any authentication (it'd seem) until it's acknowledged - # a completed OPTIONS request. Ideally this is a flaw with the controller, however as I'm not - # going to fork it to ensure compliance, checking the request method in the authentication - # seems the next best step, if the request method is OPTIONS return true, controller will simply - # call the options method within, which accesses nothing, just returns headers about dav env. - return true if @request.request_method.downcase == 'options' && (path == '/' || path.empty?) - User.current = User.try_to_login(username, password) || nil - return !User.current.anonymous? unless User.current.nil? - false + return false unless username && password + User.current = User.try_to_login(username, password) + return User.current && !User.current.anonymous? end - + def supports_locking? true end @@ -100,30 +93,30 @@ module RedmineDmsf def get(request, response) @resource_c.get(request, response) end - - def put(request, response) + + def put(request, response) @resource_c.put(request, response) end - + def delete @resource_c.delete end - + def copy(dest, overwrite = false) @resource_c.copy(dest, overwrite) end - + def move(dest, overwrite = false) @resource_c.move(dest, overwrite) - end + end def make_collection @resource_c.make_collection - end + end def special_type @resource_c.special_type - end + end def lock(args) @resource_c.lock(args) @@ -136,7 +129,7 @@ module RedmineDmsf def unlock(token) @resource_c.unlock(token) end - + def name @resource_c.name end @@ -144,7 +137,7 @@ module RedmineDmsf def long_name @resource_c.long_name end - + def resource @resource_c end