Dav4rack library upgraded to the latest stable version

This commit is contained in:
Karel Pičman 2014-06-17 09:09:28 +02:00
parent a2ee92bac2
commit 1d53518eaa
2 changed files with 8 additions and 9 deletions

View File

@ -4,7 +4,7 @@ gem 'rubyzip', '>= 1.0.0'
gem 'zip-zip' # Just to avoid 'cannot load such file -- zip/zip' error gem 'zip-zip' # Just to avoid 'cannot load such file -- zip/zip' error
gem 'simple_enum' gem 'simple_enum'
gem 'uuidtools', '~> 2.1.1' gem 'uuidtools', '~> 2.1.1'
gem 'dav4rack', '=0.2.11' gem 'dav4rack'
group :production do group :production do
gem 'nokogiri', '>= 1.5.10' gem 'nokogiri', '>= 1.5.10'

View File

@ -1,6 +1,7 @@
# Redmine plugin for Document Management System "Features" # Redmine plugin for Document Management System "Features"
# #
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk> # Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2011-14 Karel Picman <karel.picman@kontron.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@ -31,17 +32,15 @@ module RedmineDmsf
def initialize(*args) def initialize(*args)
super(*args) super(*args)
pinfo = path.split('/').drop(1) pinfo = path.split('/').drop(1)
if (pinfo.length == 0) #If this is the base_path, we're at root if (pinfo.length == 0) # If this is the base_path, we're at root
@resource_c = IndexResource.new(*args) @resource_c = IndexResource.new(*args)
elsif (pinfo.length == 1) #This is first level, and as such, project path elsif (pinfo.length == 1) #This is first level, and as such, project path
@resource_c = ProjectResource.new(*args) @resource_c = ProjectResource.new(*args)
else #We made it all the way to DMSF Data else # We made it all the way to DMSF Data
@resource_c = DmsfResource.new(*args) @resource_c = DmsfResource.new(*args)
end end
@resource_c.accessor = self if @resource_c
@resource_c.accessor= self unless @resource_c.nil?
end end
def authenticate(username, password) def authenticate(username, password)
# Bugfix: Current DAV4Rack (including production) authenticate against ALL requests # Bugfix: Current DAV4Rack (including production) authenticate against ALL requests
@ -50,8 +49,8 @@ module RedmineDmsf
# going to fork it to ensure compliance, checking the request method in the authentication # 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 # 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. # 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? ) ) return true if @request.request_method.downcase == 'options' && (path == '/' || path.empty?)
User.current = User.try_to_login(username, password) || nil User.current = User.try_to_login(username, password) || nil
return !User.current.anonymous? unless User.current.nil? return !User.current.anonymous? unless User.current.nil?
false false
end end